2017-09-06 220 views
0

adminとして実行するとPythonのセレンコードを実行できます。私は通常、それを実行すると、私はエラーを以下の取得:adminとして実行していないときに "ユーザーデータディレクトリの一時ディレクトリを作成できません"というエラーが発生しました

C:\startup>Python C:/startup/startupWebDriverScript.py  
Traceback (most recent call last): 
    File "C:/startup/startupWebDriverScript.py", line 26, in connectGuest 
    driver = webdriver.Chrome(chrome_options=chromeOptions,executable_path="C:/Python36/Chrome Webdriver/chromedriver.exe") 
    File "C:\Python36\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__ 
    desired_capabilities=desired_capabilities) 
    File "C:\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 140, in __init__ 
    self.start_session(desired_capabilities, browser_profile) 
    File "C:\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 229, in start_session 
    response = self.execute(Command.NEW_SESSION, parameters) 
    File "C:\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 297, in execute 
    self.error_handler.check_response(response) 
    File "C:\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 194, in check_response 
    raise exception_class(message, screen, stacktrace) 
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot create temp dir for user data dir 
    (Driver info: chromedriver=2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a),platform=Windows NT 10.0.15063 x86_64) 

これは私のコードです:

chromeOptions = Options() 
    chromeOptions.add_argument("--use-fake-ui-for-media-stream") 
    chromeOptions.add_argument("--kiosk") 
    chromeOptions.add_argument("--disable-notifications") 
    chromeOptions.add_argument("--disable-infobars") 
    driver = webdriver.Chrome(chrome_options=chromeOptions,executable_path="C:/Python36/Chrome Webdriver/chromedriver.exe") 

私は私の経験に基づいてのpython 3.6、Windowsの10およびセレン3.5

答えて

1

を使用しています、次のいずれかの状況が考えられます。
1)ディスクがいっぱいになっているため、空きディスクが足りません。ごみ箱を空にしたり、過度に生成された一時ファイルをチェックしてそれらを消去してみてください。

2)または、管理者権限を使用してパッケージをインストールしているため、スクリプトに実行する適切な特権がありません。

3)TMP環境変数は変更が必要な場合があります。
コンピュータを右クリックし、プロパティ - >詳細設定 - >環境変数 - >
"ユーザー変数"をクリックし、TEMPおよびTMP変数の値を "c:\ temp"に変更します。

0

さまざまなアプローチを試した後、私はChromeウェブドライバをダウングレードすることに決めました。うまく動くようになりました。

+0

どのログ/効果が 'chromedriver'をダウングレードするという考えを引き起こしたのか、かなり興味がありますか? – DebanjanB

+0

実際に私のセットアップを他の似たような設定と比較しましたが、唯一の違いはクロムドライバのバージョンでした。残念ながら、根本的な問題が何かを正確に理解できませんでした。 –

関連する問題