我是新來的硒。我想自動執行網頁上的選擇選項。我正在嘗試使用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