Getting Chrome to launch via Selenium

前端 未结 6 1141
太阳男子
太阳男子 2020-12-29 06:01

Hi all I\'m very new to this and am having issues getting an instance of a Chrome browser from selenium in python. I\'m using Windows 8. I have downloaded the chromedriver b

6条回答
  •  天涯浪人
    2020-12-29 06:50

    for python(selenium) you will need:

    from selenium import webdriver
    from selenium.webdriver import Chrome
    from selenium.webdriver.chrome.options import Options
    

    then put your chromedriver.exe path in. the "r" is just to prevent it from detecting the \ and causing errors in python

    PATH = r"C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)
    options = webdriver.ChromeOptions()
    

    you can now order the driver to get websites

    driver.get('http://www.google.com')
    

提交回复
热议问题