Configuring Mozilla with a specific profile on Saucelabs - testing

Hi when I try to run mozilla on saucelabs with testcafe with a specific profile I get the following error:
SearchSetting: get: No settings file exists, new profile? DOMException: Could not open the file at SearchSettings.sys.mjs: 140:23
/Users/chef/6hlot0zo.newlyCreated/dsearch.json.mozlz4
My Configuration in config.yml is:
name: "Firefox in sauce" platformName: "macOS 12" browserName: "firefox" browserArgs: [ "--profile ~/6hlot0zo.newlyCreated", "--jsconsole" ] mode: sauce src: - "tests/bigsur.sample.test.js" clientScripts: [ "bigsur.min.js" ]
We're doing this to get Mozilla to use fake video and audio input. If there is another way of doing that we are open to that as well. It must be with Testcafe.

Related

Appium/Protractor - Cordova app - When I try to run simple test I get following error - Failed to get sockets matching: #webview_devtools_remote_

I'm trying to run a simple test on my hybrid app with Appium + Protractor and I am unable to since I am getting following error:
Failed to get sockets matching: #webview_devtools_remote_.*15239
I am using Ubuntu, and on it I have set up Appium and Protractor, tried literally every solution I have found on the internet, could not resolve the issue.
Only thing that would "remove" the error is adding following code into capabilities:
chromeOptions: {
androidPackage: "com.android.chrome"
},
But then I only get in the app, and Appium server just gets stuck at:
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8001/wd/hub/session] with body: {"desiredCapabilities":{"chromeOption {"androidPackage":"com.android.chrome","androidUseRunningApp":true,"androidDeviceSerial":"1cdc4ed10c027ece"}}}
It won't start the spec file at all.
var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
exports.config = {
seleniumAddress: 'http://localhost:4723/wd/hub',
allScriptsTimeout: 50976,
specs: [
'test.js'
],
capabilities: {
platformName: 'Android',
platformVersion: '8.0.0',
deviceName: 'Galaxy S9',
app: 'path_to_app',
autoWebview: true,
browserName: '',
appPackage: 'app_package_name',
newCommandTimeout: '140',
chromeOptions: {
androidPackage: "com.android.chrome"
}
},
onPrepare: function () {
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
},
framework: 'jasmine',
jasmineNodeOpts: {
print: function () {}, //remove protractor dot reporter
defaultTimeoutInterval: 100000
}
}
It seems to be a common appium problem.
Issue from github: https://github.com/appium/python-client/issues/255
Fix:
See here: https://github.com/blutter/appium-crosswalk-fix
This also happens if you want to switch to a web browser on the mobile phone, while you have already instanciated an appium on a mobile app.
To avoid having this exception, such as described in
https://github.com/appium/appium/issues/11189, [Chromedriver] Error: Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. (Original error: unknown error: Failed to get sockets matching: #webview_devtools_remote_.*24811 ,
before trying to switch to your web browser on the mobile phone just, reinstantiate the appium forcefully to web like below. Appium will pilot the appp then be forced and
switch cleanly to the web browser without complaining anymore :
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome"); // or other browsers
desiredCapabilities.setCapability("noReset", true );
try
{
URL url = new URL("http://127.0.0.1:4723/wd/hub");
AppiumDriver driver = new AppiumDriver(url, desiredCapabilities);
}
catch (Exception e )
{
}
I got rid of a similar error after changing the default browser of the mobie device to Chrome from Samsung. Also updated the chromedriver version on laptop running appium server to match the version of Chrome version running on mobile. And appium was started with appium --chromedriver-executable=/usr/local/bin/chromedriver.
Also had setWebContentsDebuggingEnabled=true in desired_capabilities.

My nightwatch.js tests not runs in Chrome headless of CentOS

I run nightwatch.js tests using Nightwatch version 1.0.18 and It's working in windows environment but when I run it in centOS after installment of Xvfb I found below error.
Error while running .navigateTo() protocol action: invalid session id
Error while running .locateMultipleElements() protocol action: invalid session id
Error while running .locateMultipleElements() protocol action: invalid session id
Here is my nightwatch.json file code:
{
"src_folders": [
"./tests"
],
"output_folder": "./reports",
"custom_commands_path": "./custom_commands",
"custom_assertions_path": "",
"test_workers": false,
"webdriver": {
"start_process": true
},
"test_settings": {
"default": {
"webdriver": {
"port": 9515,
"server_path": "./node_modules/chromedriver/lib/chromedriver/chromedriver",
"cli_args": [
"--log",
"debug"
]
},
"skip_testcases_on_fail": true,
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args": [
"headless",
"no-sandbox",
"disable-gpu"
]
}
}
}
}
}
am I missing something to run my tests in the centOS environment because it is running in the windows environment?
I had the same issue with Nightwatchjs and the npm chomedriver setup.
Background:
Everything was working until I just recently updated Chromium on my system. In addition to the errors in the original post, verbose logging also showed:
{
message: 'unknown error: Chrome failed to start: exited abnormally',
error: [
"(unknown error: DevToolsActivePort file doesn't exist)",
'(The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)',
'(Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.9.0-8-amd64 x86_64)'
],
}
After downloading the standalone chromedriver (2.46.628388) to match my Chromium version (72.0.3626.69) it was still showing the same errors.
Solution:
I ended up downloading an older version of Chromium (71.0.3578.127) and setting chromeOptions.binary to the new path of the chromium 71 binary. I also had to include 'no-sandbox' with chromeOptions.args.
Here is the snippet from the site mentioned above:
Downloading old builds of Chrome / Chromium
Let's say you want a build of Chrome 44 for debugging purposes. Google does not offer old builds as they do not have up-to-date security fixes.
However, you can get a build of Chromium 44.x which should mostly match the stable release. Here's how you find it:
Look in https://googlechromereleases.blogspot.com/search/label/Stable%20updates for the last time "44." was mentioned.
Loop up that version history ("44.0.2403.157") in the Position Lookup
In this case it returns a base position of "330231". This is the commit of where the 44 release was branched, back in May 2015.*
Open the continuous builds archive
Click through on your platform (Linux/Mac/Win)
Paste "330231" into the filter field at the top and wait for all the results to XHR in.
Eventually I get a perfect hit: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/330231/
Sometimes you may have to decrement the commit number until you find one.
Download and run!
Upgrading to the latest version of chromedriver solved the issue for me. You can find the latest version here; https://www.npmjs.com/package/chromedriver
In my situation, when that error occurs:
Error while running .navigateTo() protocol action: invalid session id
I added the following code into .travis.yml:
addons:
chrome: stable

Protractor test broke after enabling local SSL certificate

My Protractor and Typescript based test code is broken, after team install local SSL certificate on the server. Though it able to load the provided URL on browser but still throwing error " Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds. This may be because the current page is not an Angular application."
Based on Protractor-invalid-ssl link have added below snippet in my config but still it throw same error. Have also tried with other options:
acceptSslCerts: true, trustAllSSLCertificates: true, acceptInsecureCerts:true,
ACCEPT_SSL_CERTS:true
But none of the option/arguments work.
/**Browser capabilities */
capabilities: {
browserName: 'chrome',
marionette : true,
acceptInsecureCerts : true
},
Have also tried with firefox still getting same error.
Using Node v8.11.3, chrome 69.0, Protractor 5.4.0, Jasmine 2
When using browser 'chrome', do not set marionette propertie its firefox specific.
You can try with the following capability for chrome:
capabilities: {
browserName: 'chrome',
trustAllSSLCertificates: true,
acceptInsecureCerts: true,
ACCEPT_SSL_CERTS: true,
},

How to change browser language of webdriverio

I would like to change browser language. but it is not working. default browser language is displayed..
capabilities: [{
browserName: 'chrome',
chromeOptions: {
args: ['--lang=ja']
}
}],
If anyone is still interested in making this work, the WebdriverIO implementation would be:
capabilities: [{
browserName: 'chrome',
'goog:chromeOptions': {
args: [ '--your-args-go-here',
'--like-so',
'--and-so-and-so'
// e.g: '--headless', '--disable-gpu', '--start-fullscreen'
],
prefs: {
'intl.accept_languages': 'ru,RU'
}
}
}]
For the full list of Chromium switches (args array values), click here.
For the full list of Chromium preferences (prefs object properties), click here.
Note: another useful resource (which is always up to date) for Chromium switches is Peter Beverloo's Chromium CLI Switches portal.
Using the above Chrome config in the wdio.conf.js & running an Instagram login test will successfully convert the locale of the page to Russian, as seen below:
could you try this instead?
options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'})
driver = webdriver.Chrome(chrome_options=options)
check on webdriver io how to use add_experimental_option

How to use Browserstack's mobile device testing feature using protractor scripts?

I have written a spec and a config file that run using protractor and browserstack to test a website on different browsers. I am trying to utilize browserstack's mobile device testing feature by editing the config to test a device.
When protractor filename-conf is run the following error is returned.
"WebDriverError: Not yet implementd. Please help us: htttp://appium.io/get-involved.html"
Here is the config that attempts to run the spec on a mobile web browser.
exports.config = {
seleniumAddress: 'http://hub.browserstack.com/wd/hub',
specs: [
'example-spec.js'
],
multiCapabilities: [{
browserName : 'iPhone',
'platform' : 'MAC',
'device' : 'iPhone 5S',
'deviceOrientation' : 'portait',
'project' : 'Isengard Mobile Automation',
'build' : 'Mobile Test',
'browserstack.user': 'username',
'browserstack.key': 'keyname',
acceptSslCerts: 'true'
directConnect: true
}],
Do I need appium to utilize browserstacks mobile testing?
BrowserStack uses Appium to drive your Selenium tests on iOS. The exception you received probably indicates a certain Selenium command you executed, is not supported yet by Appium.
You need NOT download Appium to run your Selenium scripts on BrowserStack's mobile testing platform. You simply have to change the capabilities (as you've done) and you should be good to go.
I would recommend reaching out to BrowserStack's Support (support#browserstack.com) as they would be the best guys to help you with this :)
Note: The capabilities you've mentioned for iOS are correct as given in BrowserStack's documentation here. You need not make any changes there.
Few changes required as also suggested in the comments to your capabilities -
multiCapabilities: [
{
platformName: 'iOS',
platformVersion: '7.1',
browserName: '',
app: '<your app name>',
deviceName: 'iPhone 5S',
'deviceOrientation' : 'portait',
'project' : 'Isengard Mobile Automation',
'build' : 'Mobile Test',
'appium-version': "1.4.0",
username: '<USERNAME>',
accessKey: '<KEY>',
acceptSslCerts: 'true',
directConnect: 'true'
}],