selenium can open the browser but the page is blank without entering the URL

A novice like me is constantly stepping on the pit in the process of learning.

Today, I am running a simple python+selenium test demo to open the Firefox browser and enter the Baidu URL.

import time
from selenium import webdriver

browser = webdriver.Firefox()
url = "http://wwww.baidu.com"
browser.get(url)
browser.find_element_by_id("kw").send_keys("selenium")
browser.find_element_by_id("su").click()
time.sleep(3)
browser.quit()

  

Found that the browser can be opened normally. But does the page really look like this?

 

It was a bit confusing at the time, because the program ran fine before. The browser and Baidu can be opened normally.

I installed python2.7+selenium2.53.6+Firefox45.

Then Baidu took a look. It turned out that this happened because the selenium version did not match the version of the Firefox browser.

Then I checked my Firefox browser, F**K, it turned out that it was automatically upgraded to Firefox47.

After uninstalling version 47 and reinstalling version 45, the program runs normally.

Selenium2 can support Firefox browser version 45 and below.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325166594&siteId=291194637