无法通过Python Selenium查看打开Chrome浏览器的结果

时间:2018-02-22 15:01:16

标签: python selenium-chromedriver

驱动程序版本为2.35
python版本3.6.1
代码执行时没有错误,但我在窗口上看不到任何内容 这是python代码:

def click_red_links():
try:
    driver = webdriver.Chrome(executable_path='C:/xampp/htdocs/scout-project-master/chromedriver.exe', service_args=['--whitelisted-ips="x.x.x.x'])
    driver.get('https://www.facebook.com')
    driver.maximize_window()
    driver.implicitly_wait(30)  # wait 30 seconds.
    print(driver.title)
    driver.quit()
except ValueError:
    print('coudl not open the borwser read: {}'.format(WebDriverException))

1 个答案:

答案 0 :(得分:0)

from selenium import webdriver
def click_red_links():
    try:
        driver = webdriver.Chrome(executable_path='chromedriver.exe', service_args=['--whitelisted-ips="x.x.x.x'])
        driver.get('https://www.facebook.com')
        driver.maximize_window()
        driver.implicitly_wait(30)  # wait 30 seconds.
        print(driver.title)
        #driver.quit()
    except ValueError:
        print('coudl not open the borwser read: {}'.format(WebDriverException))

enter image description here

使用这个webdriver:https://chromedriver.storage.googleapis.com/index.html?path=2.35/

,它适用于Python 3.6.3

ChromeDriver控制台是否打开或Chrome是否会打开,或者在您运行时没有任何反应?