我想使用RSelenium使我的电子邮件自动化,但是有一个非常嵌套的元素(请参见标记位置),这使我花费了几个小时。这不起作用:
es1 <- remDr$findElement(using = 'xpath', value = '//*[@id="id6"]')
然后我尝试这个(洋葱策略):
es1 <- remDr$findElement(using = 'xpath', value = '//*[@id="app-contents-wrapper"]/atl-app-stack/atl-app-iframe[3]')$findElement(using = 'xpath', value = '//*[@id="thirdPartyFrame_home"]')$findElement(using = 'xpath', value = '/html')$findElement(using = 'xpath', value = '/html/body')
到目前为止,每个人都很好!但是,如果我拖了下一个:
es1 <- remDr$findElement(using = 'xpath', value = '//*[@id="app-contents-wrapper"]/atl-app-stack/atl-app-iframe[3]')$findElement(using = 'xpath', value = '//*[@id="thirdPartyFrame_home"]')$findElement(using = 'xpath', value = '/html')$findElement(using = 'xpath', value = '/html/body')$findElement(using = 'xpath', value = '//*[@id="id56"]')
R产生了此错误消息(并且如果我直接执行id6,也是如此):
Selenium message:no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="id56"]"}
(Session info: chrome=69.0.3497.92)
(Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.15.0-34-generic x86_64)
Fehler: Summary: NoSuchElement
Detail: An element could not be located on the page using the given search parameters.
Further Details: run errorDetails method
有人可以解决这个问题吗?