selenium search
生活随笔
收集整理的這篇文章主要介紹了
selenium search
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
from selenium import webdriverfrom selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Firefox() # Get local session of firefox
browser.get("http://www.yahoo.com") # Load page
assert "Yahoo!" in browser.title
elem = browser.find_element_by_name("p") # Find the query box
elem.send_keys("seleniumhq" + Keys.RETURN)
time.sleep(0.2) # Let the page load, will be added to the API
try:
? ? browser.find_element_by_xpath("//a[contains( @href ,'http://seleniumhq.org')]")
except NoSuchElementException:
? ? assert 0, "can't find seleniumhq"
browser.close()
轉載于:https://my.oschina.net/u/938257/blog/103572
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的selenium search的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [Rails.Test.Prescrip
- 下一篇: Xfire方式开发和解析webservi