![](/img/trans.png)
[英]Button clicked but nothing happens on webpage(Selenium WebDriver)
[英]Python selenium webdriver gets nothing but the browser normally shows the webpage
源代碼:
from selenium import webdriver
browser = webdriver.Safari()
html_doc = browser.get("http://www.google.com")
#html_doc is empty but the Safari window shows the page normally
#Allow Remote Automation is enabled
這是我第一次使用Selenium,起初它可以正常工作,而html_doc通常可以獲取內容,但是,問題在幾個小時后發生,並且既沒有重新啟動Python也沒有重新啟動計算機。 感謝您的任何建議!
browser.get
不返回任何內容,這就是html_doc
為空的原因。 如果您想要頁面源,則需要使用page_source
browser.get("http://www.google.com")
html_doc = browser.page_source
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.