[Resolved] Python + selenium from selenium import webdriver pycharm execution error problem

Coding. 8 = UTF-#
from the webdriver Selenium Import
from selenium.webdriver.firefox.firefox_binary Import FirefoxBinary
#binary FirefoxBinary = ( '/ path / to / binary')
binary = FirefoxBinary (r'D: \ Program Files (the x86) \ the Mozilla firefox \ firefox.exe ')
Driver = webdriver.Firefox (= binary firefox_binary) driver.get (' http://www.baidu.com ')
driver.find_element_by_id (' kW '). send_keys (' selenium2 ')
Driver. find_element_by_id ( 'su') the click ().
river.quit
above to open the code I wrote the Baidu search, using selenium3.11 version, run the code always reported selenium can not find
solutions:
1. look at selenium has not been installed, D: \ Program files (x86 ) \ python \ Lib \ folder selenium have no site-packages, if no
pip install -U selenium command to install
2.If there is, then selenium or report this error, possibly python version of the project configuration problem (I was this mistake)
As shown, file-setting path configured python version, you can add the actual path of your python.exe. After it can modify the normal operation of the
 

Published 30 original articles · won praise 7 · views 6746

Guess you like

Origin blog.csdn.net/w68688686/article/details/104279807