我是新来的硒。我想自动执行网页上的选择选项。我正在尝试使用xpath选择。是否有可能得到innerHTML没有id,但只有xpath? 如果是的话如何?如果没有,那么如何解决与选择问题。in硒xpath and innerHTML
0
A
回答
0
反正 - 没有页面的HTML代码,我只能给你提供关于XPath的一般建议。看到这个页面:http://zvon.org/xxl/XPathTutorial/Output/example1.html
它帮助了我很多理解的XPath方法
1
是的,这是可能的。从这里开始:http://www.w3schools.com/xpath/。
而且这里有一个快速下拉例如在python:
from selenium.webdriver import Chrome
SETTINGS_PAGE_URL = 'chrome://settings/browser'
SEARCH_ENGINE_DROPDOWN_ID = 'defaultSearchEngine'
SEARCH_ENGINE_CHOICE_XPATH = '//option[text()="Google"]'
browser = Chrome()
browser.get(SETTINGS_PAGE_URL)
dropdown = browser.find_element_by_id(SEARCH_ENGINE_DROPDOWN_ID)
option = dropdown.find_element_by_xpath(SEARCH_ENGINE_CHOICE_XPATH)
option.click()
相关问题
- 1. onclick and change innerhtml
- 2. xPath中的innerHTML?
- 3. XPath和innerHTML的
- 4. 硒:无效的XPath为硒
- 5. AND NOT(AND)(NOT)together in query
- 6. BFS in python from preorder and in
- 7. LINQ to SQL in and not in
- 8. 硒xpath查询
- 9. 修改的innerHTML使用硒
- 10. lapply and data.frame in R
- 11. Queue in php and postgres
- 12. Group and count in Rails
- 13. if and else in Aurelia.js
- 14. Linker and complitation in C
- 15. eval and test_minibatch in cntk
- 16. onCreate and Initialization in Android
- 17. Factorial in numpy and scipy
- 18. Drag and Drop in 3.0
- 19. memcpy and free in c
- 20. crc32 in php and as3
- 21. Pickle and exec in python
- 22. onpopstate in chrome and firefox
- 23. python webdriver:从innerHTML获取XPATH
- 24. 硒模式的XPath
- 25. onBlur in innerHtml块的功能
- 26. Roll 3 die 50 times and each each in a array and display in html
- 27. 硒不能与XPath
- 28. 硒XPATH为下拉
- 29. 使用硒的XPath
- 30. xpath小括号硒
您可以添加页面怎么样子? (页面的HTML代码) –
使用xpaths时非常好的链接http://test-able.blogspot.ie/2016/04/xpath-selectors-cheat-sheet.html – 2017-05-30 14:36:37