Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to get operadriver 2.42 to work with Opera browser 58.x #86

Open
JBaker2508 opened this issue Feb 1, 2021 · 0 comments
Open

Comments

@JBaker2508
Copy link

I've been doing product development and testing for the past 10 years and took over our company's R&D selenium testing for one of our products a couple years ago. I'm in the process of updating our C# test framework that tests our product's webserver functionality across a series of browsers. One of the browsers recently added by PM was Opera. Currently, we are using the following versioning in our framework:

Selenium WebDriver: V3.141.0.0
Selenium WebDriver.Support: V3.141.0.0
Operadriver_win64: V2.42
Opera Browser: 58.0.3135.127

PM specified we had to ensure we support Opera 58.x for our customer as this will be documented to the customer in our next product release, so unfortunately I'm tied to testing against this specific version.

I've done some extensive reading online about automating Opera. I determined from GitHub that I needed the operachromiumdriver v2.42 for my specifc 58.x version of Opera.

string localappdata = Environment.GetEnvironmentVariable("LocalAppData");
operadriverDir = Directory.GetCurrentDirectory();
operadriverExe = @"operadriver.exe";

OperaOptions operaOptions = new OperaOptions
{
     LeaveBrowserRunning = false,
     BinaryLocation = localappdata + @"\Programs\Opera\58.0.3135.127\opera.exe"
};
operaOptions.AddArgument("--user-data-dir=" + localappdata + @"\Google\Chrome\Opera\User Data");

var service_opera = OperaDriverService.CreateDefaultService(operadriverDir, operadriverExe);
service_opera.EnableVerboseLogging = true;
service_opera.Start();
int port = service_opera.Port;

operaOptions.AddArgument("--remote-debugging-port=" + port.ToString());
driver = new OperaDriver(service_opera, operaOptions);

When I ran the above code with nunit as administrator, the following 3 things happen in order:

 1. Operadriver.exe console window launches
 2. OperaSoftware.OperaWebBrowser.1610649940 console window launches An
 3. instance of Opera.exe launches

At this point, nunit indicates the following error for this test:

SystemTest_S7_1200.Communications._45WebServer._456_WebServer_Opera._45001_BasicFunctionality:
SetUp : OpenQA.Selenium.WebDriverException : unknown error: Opera failed to start: crashed
  (Opera not reachable)
  (The process started from chrome location C:\Users\System Test\AppData\Local\Programs\Opera\58.0.3135.127\opera.exe is no longer running, so OperaDriver is assuming that Opera has crashed.)
  (Driver info: OperaDriver=2.42.3135 (O58),platform=Windows NT 10.0.17763 x86_64)

I was a bit confused by this error because I can clearly see Opera started. So, I got looking at the logging for operadriver.exe:

Starting OperaDriver 2.42.3135 (O58) on port 37604
Only local connections are allowed.
[1612215723.848][INFO]: [0d995150afccdcc03195334ce4f36367] COMMAND InitSession {
   "capabilities": {
      "firstMatch": [ {
         "acceptInsecureCerts": true,
         "browserName": "opera"
      } ]
   },
   "desiredCapabilities": {
      "acceptInsecureCerts": true,
      "browserName": "opera",
      "operaOptions": {
         "args": [ "--user-data-dir=C:\\Users\\System Test\\AppData\\Local\\Google\\Chrome\\Opera\\BlankUserData", "--disable-extensions", "--remote-debugging-port=37604" ],
         "binary": "C:\\Users\\System Test\\AppData\\Local\\Programs\\Opera\\58.0.3135.127\\opera.exe"
      }
   }
}
[1612215723.850][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_setting_values": {
         "geolocation": 1
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[1612215723.854][INFO]: Populating Local State file: {
   "ab_testing": {
      "uid": "MjRlNmUzZmEtNDJmNS00YTI3LWI4YTQtMTk1MTY2YmEwMTU3"
   },
   "background_mode": {
      "enabled": false
   },
   "browserjs": {
      "version": "1540378800"
   },
   "component_updater": {
      "widevine": {
         "up_to_date": false
      }
   },
   "hardware_acceleration_mode_previous": true,
   "location": {
      "country": "us",
      "country_from_server": "unknown"
   },
   "partner_content": {
      "version": {
         "default": 61
      }
   },
   "password_manager": {
      "os_password_blank": false,
      "os_password_last_changed": "13255103709737702"
   },
   "shutdown": {
      "num_processes": 2,
      "num_processes_slow": 1,
      "performed": true,
      "type": 2
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   },
   "startup_metric": {
      "last_startup_timestamp": "13256688446647647",
      "last_startup_version": "71.0.3578.98",
      "same_version_startup_count": 19
   },
   "subresource_filter": {
      "ruleset_version": {
         "checksum": 1918231743,
         "content": "9.18.0",
         "format": 23
      }
   },
   "update": {
      "last_verify_time": "13256674004800030"
   },
   "updateclientdata": {
      "apps": {
         "aemomkdncapdnfajjbbcbdebjljbpmpj": {
            "cohort": "",
            "cohortname": "",
            "dlrc": 5145,
            "pf": "cc1d9041-3721-4533-b352-426560ac1a21"
         },
         "gcmjkmgdlgnkkcocmoeiminaijmmjnii": {
            "cohort": "1:bm1:[email protected]",
            "cohortname": "M54ToM99",
            "dlrc": 5145,
            "pf": "6fd7e0e8-4cbf-4fa5-9f1e-8f3d1990b5b7"
         },
        "hfnkpimlhhgieaddgfemjhofmfblmnib": {
            "cohort": "1:jcl:",
            "cohortname": "Auto",
            "dlrc": 5145,
            "pf": "e3b2fb1e-0ebb-45a6-a5e9-6a77ef613f0e"
         },
         "oimompecagnajdejgnnjijobebaeigek": {
            "cohort": "",
            "cohortname": "",
            "dlrc": 5145,
            "pf": "2b5860db-7759-4ddf-b9ad-3ecceb3ec7c8"
         }
      }
   }
}
[1612215723.864][INFO]: Launching Opera: "C:\Users\System Test\AppData\Local\Programs\Opera\58.0.3135.127\opera.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-extensions --disable-extensions-except="C:\Users\SYSTEM~1\AppData\Local\Temp\scoped_dir912_5937\internal" --disable-hang-monitor --disable-popup-blocking --disable-presto-profile-migration --disable-prompt-on-repost --disable-sync --disable-update --disable-usage-statistics-question --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --log-level=0 --metrics-recording-only --no-default-browser-check --no-first-run --password-store=basic --ran-launcher --remote-debugging-port=37604 --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\System Test\AppData\Local\Google\Chrome\Opera\BlankUserData"
[1612215723.870][DEBUG]: DevTools HTTP Request: http://localhost:37604/json/version
[1612215723.874][DEBUG]: DevTools HTTP Request failed
[1612215723.953][DEBUG]: DevTools HTTP Request: http://localhost:37604/json/version
[1612215723.954][DEBUG]: DevTools HTTP Request failed
[1612215724.014][DEBUG]: DevTools HTTP Request: http://localhost:37604/json/version
[1612215724.016][DEBUG]: DevTools HTTP Request failed
[1612215724.076][DEBUG]: DevTools HTTP Request: http://localhost:37604/json/version
[1612215724.079][DEBUG]: DevTools HTTP Request failed
[1612215724.140][DEBUG]: DevTools HTTP Request: http://localhost:37604/json/version
[1612215724.141][DEBUG]: DevTools HTTP Request failed
[1612215724.217][DEBUG]: DevTools HTTP Request: http://localhost:37604/json/version
[1612215724.220][DEBUG]: DevTools HTTP Request failed
[1612215724.283][DEBUG]: DevTools HTTP Request: http://localhost:37604/json/version
[1612215724.285][DEBUG]: DevTools HTTP Request failed
[1612215724.360][DEBUG]: DevTools HTTP Request: http://localhost:37604/json/version
[1612215724.364][DEBUG]: DevTools HTTP Request failed
[1612215724.425][DEBUG]: DevTools HTTP Request: http://localhost:37604/json/version
[1612215724.448][DEBUG]: DevTools HTTP Request failed
[1612215724.518][DEBUG]: DevTools HTTP Request: http://localhost:37604/json/version
[1612215724.854][DEBUG]: DevTools HTTP Request failed
[1612215724.946][INFO]: [0d995150afccdcc03195334ce4f36367] RESPONSE InitSession ERROR unknown error: Opera failed to start: crashed
  (Opera not reachable)
  (The process started from chrome location C:\Users\System Test\AppData\Local\Programs\Opera\58.0.3135.127\opera.exe is no longer running, so OperaDriver is assuming that Opera has crashed.)
[1612215724.983][DEBUG]: Log type 'driver' lost 0 entries on destruction
[1612215724.997][DEBUG]: Log type 'browser' lost 0 entries on destruction

In the OperaSoftware.OperaWebBrowser console, the following is logged:

[8116:8468:0201/164204.426:ERROR:tcp_socket_win.cc(355)] bind() returned an error: Only one usage of each socket address (protocol/network address/port) is normally permitted. (0x2740)
[8116:8468:0201/164204.442:ERROR:tcp_socket_win.cc(355)] bind() returned an error: Only one usage of each socket address (protocol/network address/port) is normally permitted. (0x2740)
[8116:8468:0201/164204.473:ERROR:devtools_http_handler.cc(295)] Cannot start http server for devtools.
[8116:3184:0201/164205.297:ERROR:gpu_process_transport_factory.cc(967)] Lost UI shared context.

I know I'm really close here to having it working... The thing I believe is my hurdle here is that DevTools HTTP Requests fail on multiple attempts, eventually resulting in the InitSession failing because it fails to reach/attach to Opera.

My question... what am I missing here? With the other browsers we test like Chrome, IE11, etc, launching the webdriver and attaching to the browser instance isn't hard at all. I'm afraid that whatever I'm missing is blatantly obvious and I'm just not seeing it. Of course, from what I've researched online, I didn't see anything clear and definitive when it comes to testing with Opera. Any input is much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant