Home > other >  [python] to solve: the driver can adjust the browser, but can't operate the browser
[python] to solve: the driver can adjust the browser, but can't operate the browser

Time:09-21

An error is as follows:
Message: chrome not reachable
(Driver info: chromedriver=2.38.552522 e6fbedfa8762dec75e2c5b3ddb86763dc9dcb (437), the platform=Windows NT 10.0.18363 x86_64)

The code is as follows:
Def startBrowser (name) :
Try:
If name=="sogou" :
# to Chrome a binary
The options=webdriver. ChromeOptions () #
start parametersOptions. Binary_location=SogouBrowser_location
Chrome_driver_binary=SogouBrowser_path
Print (" start the browser name: sogou ")
Driver=webdriver. Chrome (executable_path=chrome_driver_binary, options=options)
Return driver
The else:
Print (" Not found this browser, You can use 'firefox', 'chrome', 'ie' or 'phantomjs ")
Except the Exception as MSG:
Print (" launch a browser appears unusual: % s "% STR (MSG))

@ threads (5)
Def run_case (name) :
Driver=startBrowser (name)
Driver. The get (open_url)
Time. Sleep (3)
Print (driver. The title)
Driver. The quit ()

If __name__=="__main__" :
Names=[" sogou "]
For I in names:
Run_case (I)
  • Related