通過tile和url判斷頁面跳轉是否正確

來源:互聯網
上載者:User

標籤:判斷   rom   link   color   time   port   url   擷取   click   

通過webdriver中的.title和.current_url擷取title和url

 1 from time import sleep 2  3 from selenium import webdriver 4 browser=webdriver.Firefox() 5 browser.get("http://www.zuzuche.com") 6 browser.find_element_by_link_text(u"門票玩樂").click() 7 sleep(3) 8 #擷取當前的title 9 title=browser.title10 print(title)11 #對title做判斷12 if title==u"景點門票_特賣門票_門票優惠_打折門票_一日遊_特價一日遊_玩樂推薦_通票-租租車":13     print("title ok")14 else:15     print("title no")16 #擷取當前的url17 now_url=browser.current_url18 print(now_url)19 #對url做判斷20 if now_url=="http://poi.zuzuche.com/index-entrance-284ab515c664b25eb22fd29aaf3d553d.html?source=10000":21     print("url ok")22 else:23     print("url on")24 sleep(3)25 26 browser.quit()

 

通過tile和url判斷頁面跳轉是否正確

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.