I have <script language = 'javascript'></script>
in html
file. I used driver.find_elements_by_xpath("//script[@language]")
but it's not working. How can i fix it?
看看这是否有效:
driver.find_element_by_tag_name("script")
我会试试这个:
driver.find_element_by_xpath("//script[@language='javascript']")
You are using find_elements
which will return a list. for a single web element we want to use find_element
.
if there's a single language
attribute, you can probably try this :
script_web_element = driver.find_element_by_xpath("//script[@language]")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.