2016-08-09 34 views
0

この質問は何度も尋ねられていますが、それらをチェックしても解決できませんでした。アウトなぜそれがコードの行の下に実行.After発生しているリモートブラウザとの通信でエラーが発生した可能性があります。

driver.get(first_url) 
    #here i open forst url the perform some operation  
    main_window =driver.current_window_handle 
    driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + "t") 
    #above line opens a new tab 
    # Put focus on current window which will, in fact, put focus on the current visible tab 
    main_window_new =driver.current_window_handle 
    driver.switch_to_window(main_window_new) 
    time.sleep(1) 
    driver.get(second_url) 
    #opening new tab in the existing browser 
    time.sleep(2) 
    json_str=driver.find_element_by_tag_name('body').text 
    time.sleep(1) 
    print json 
    # Close current tab 
    driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 'w') 

    # Put focus on current window which will be the window opener 
    driver.switch_to_window(main_window) 

私はこのエラーに上記execuionため

Message: Error communicating with the remote browser. It may have died. Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58' System info: host: 'BLR-CSM-1', ip: '172.17.1.34', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101' Driver info: driver.version: RemoteWebDriver Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=35.0, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID: d7ac8e9e-2c20-48c6-82fd-ce8eaec93b46 Stacktrace: ('Unexpected error:', )

Seleniumサーバーのログを取得

13:21:08.048 INFO - Executing: [get current window handle]) 
13:21:08.058 INFO - Done: [get current window handle] 
13:21:08.060 INFO - Executing: [find element: By.tagName: body]) 
13:21:08.068 INFO - Done: [find element: By.tagName: body] 
13:21:08.071 INFO - Executing: [send keys: 603 [[FirefoxDriver: firefox on WINDO 
WS (d52fe7cd-ee42-41f7-b065-ec1e853e1011)] -> tag name: body], [?, t]]) 
13:21:08.097 INFO - Done: [send keys: 603 [[FirefoxDriver: firefox on WINDOWS (d 
52fe7cd-ee42-41f7-b065-ec1e853e1011)] -> tag name: body], [?, t]] 
13:21:10.107 INFO - Executing: [get current window handle]) 
13:21:10.118 INFO - Done: [get current window handle] 
13:21:10.122 INFO - Executing: [switch to window: {1d2e0152-8716-466e-bb62-d0a96 
073fb3b}]) 
13:21:10.130 INFO - Done: [switch to window: {1d2e0152-8716-466e-bb62-d0a96073fb 
3b}] 
13:21:11.133 INFO - Executing: [get:https://myar.axyza.com/monitor/getStatsData? 
graphTypeId=0]) 
13:21:12.173 INFO - Done: [get: https://myar.axyza.com/monitor/getStatsData? 
graphTypeId=0])] 
13:21:14.176 INFO - Executing: [find element: By.tagName: body]) 
13:21:14.185 INFO - Done: [find element: By.tagName: body] 
13:21:14.188 INFO - Executing: [get text: 853 [[FirefoxDriver: firefox on WINDOW 
S (d52fe7cd-ee42-41f7-b065-ec1e853e1011)] -> tag name: body]]) 
13:21:14.215 INFO - Done: [get text: 853 [[FirefoxDriver: firefox on WINDOWS (d5 
2fe7cd-ee42-41f7-b065-ec1e853e1011)] -> tag name: body]] 
13:21:15.221 INFO - Executing: [find element: By.tagName: body]) 
13:21:15.233 INFO - Done: [find element: By.tagName: body] 
13:21:15.237 INFO - Executing: [send keys: 853 [[FirefoxDriver: firefox on WINDO 
WS (d52fe7cd-ee42-41f7-b065-ec1e853e1011)] -> tag name: body], [?, w]]) 
13:21:15.367 INFO - Done: [send keys: 853 [[FirefoxDriver: firefox on WINDOWS (d 
52fe7cd-ee42-41f7-b065-ec1e853e1011)] -> tag name: body], [?, w]] 
13:21:17.371 INFO - Executing: [switch to window: {1d2e0152-8716-466e-bb62-d0a96 
073fb3b}]) 
13:21:18.417 INFO - Executing: [close window]) 

何か助けていただければ幸いです。

+0

申し訳ありませんが、エラーはどこですか?私はちょうど情報ログを参照してください –

+0

@Rudziankoŭ上記の –

+0

を見つけるためにあなたは 'soucelabs'または' browserstack'のようないくつかのリモートサービスを使用していますか?テストはどのくらいの期間実行されますか? –

答えて

1

タブが1つだけ開いている場合は、次の行でブラウザが閉じられるため、

# remove that line and run your code. You will not see this error again. 
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 'w') 
+0

実際には2つのタブを開きます。上のコードスニペットは、既存のブラウザで新しいタブを開くためのものです。いくつかの操作を実行してから、前の既存のタブに戻しています。 –

+0

@AmarKスクリプトを実行します。そしてそれは私のためにうまくいく。どのブラウザを使用していますか?ブラウザのバージョンあなたのセレンのバージョンも何ですか? –

+0

申し訳ありませんが私の悪い私は以前の質問の説明に記載する必要があります。上記のコードを参照してください適切に変更された参照してください。 –

関連する問題