Selenium3定位不到script及其后面的元素。

 

用绝对路径定位到script之前的所有元素都没问题,但script标签定位不到,且script后面的其他元素也定位不到。

driver.find_element_by_xpath("/html/body/form/font/table/tbody/tr[4]/td/table/tbody/t
r/td/table[2]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td")没有问题

但是

driver.find_element_by_xpath("/html/body/form/font/table/tbody/tr[4]/td/table/tbody/t
r/td/table[2]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td/script")显
示错误如下

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/form/font/table/tbody/tr[4]/td/table/tbody/tr/td/table[2]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td/script"}

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 以帮助更多的人 ^-^