2016-09-19 18 views
2

こんにちは!起動時ウィンドウのオプションがWindowsで動作しない

現在Windows 7 OSでSeleniumでChromeを使用していますが、--no-startup-windowを使用しようとしました。ただし、このオプションは次のエラーでセレンが墜落:

Traceback (most recent call last): 
    File "program_test.py", line 234, in <module> 
    main() 
    File "program_test.py", line 36, in main 
    initChromeWebDriver() 
    File "c:\opt\project\auto\common\driver.py", line 27, in initChromeWebDriver 
    driver = webdriver.Chrome("C:\\chromedriver.exe", chrome_options=chrome_options) 
    File "c:\opt\project\env\lib\site-packages\selenium\webdriver\chrome\webdriver.p 
y", line 67, in __init__ 
    desired_capabilities=desired_capabilities) 
    File "c:\opt\project\env\lib\site-packages\selenium\webdriver\remote\webdriver.p 
y", line 91, in __init__ 
    self.start_session(desired_capabilities, browser_profile) 
    File "c:\opt\project\env\lib\site-packages\selenium\webdriver\remote\webdriver.p 
y", line 173, in start_session 
    'desiredCapabilities': desired_capabilities, 
    File "c:\opt\project\env\lib\site-packages\selenium\webdriver\remote\webdriver.p 
y", line 233, in execute 
    self.error_handler.check_response(response) 
    File "c:\opt\project\env\lib\site-packages\selenium\webdriver\remote\errorhandle 
r.py", line 194, in check_response 
    raise exception_class(message, screen, stacktrace) 
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to st 
art: exited normally 
    (Driver info: chromedriver=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9cf),platfo 
rm=Windows NT 6.1.7601 SP1 x86_64) 

コードの私の作品があります:このオプションを指定しない

chrome_options = webdriver.ChromeOptions() 
chrome_options.add_argument("--no-startup-window") 
driver = webdriver.Chrome("C:\\chromedriver.exe", chrome_options=chrome_options) 

は、Chromeは私が行をコメント場合は起動することができます。

この問題に関するご意見はありますか?

+0

こんにちは、この問題を解決できましたか? – pratibha

+0

@pratibha:残念ながら、私はあきらめました。私はあなたがおそらくWebドライバのためにChromeへのチケットを開く必要があると思う...あなたの研究の後に解決策を見つけたら、答えを投稿してください、私は非常に興味があります:) – toshiro92

答えて

0

クロム59には "--headless"オプションが付いています。私はPython 2.7とSelenium 3でそれを使用しています。魅力的に働きました。 "--no-startup-window"の代わりに "--headless"を試してください

+0

Ok、 59育った:) – toshiro92

関連する問題