Source Code:
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
This is the first time I use Selenium, at first it worked normally, with html_doc normally gets the content, however, the problem occurred several hours later, and neither restart Python nor restart the computer worked. Thanks for any suggestions!
browser.get
doesn't return anything, that's why html_doc
is empty. If you want the page source you need to use page_source
browser.get("http://www.google.com")
html_doc = browser.page_source