Nightwatch can't launch chromium after upgrading to Ubuntu 19.10 - javascript

My Nightwatch test suite was running just fine until I upgraded Ubuntu to 19.10. Now, when the browser launches from the test script I get an error message:
Failed to load extension from: . Manifest file is missing or unreadable
The Ubuntu install upgraded Chromium to 78.0.3904.70, and also switched to the snap version. I don't know which of these changes has caused the symptom I'm seeing.
I've upgraded chromedriver to match the same version as Chromium.
Chromium itself launches just fine as a browser, so the other solutions I've seen as search results, finding and deleting existing Chrome profiles, etc, I don't want to do. Ideally I'd like the browser that my nightwatch tests launch to be independent of any existing user profiles.
For reference, my Nightwatch config is:
// eslint-disable-next-line camelcase
const selenium_port = process.env.SELENIUM_PORT || 4444
const chromeArgs = process.env.SHOW_BROWSER ? [] : ['headless']
const driver = process.env.CHROMEDRIVER
module.exports = {
page_objects_path: './tests/e2e/page-objects',
test_settings: {
default: {
globals: {
waitForConditionTimeout: 5000
},
selenium_port,
desiredCapabilities: {
browserName: 'chrome',
chromeOptions: {
args: chromeArgs
}
},
webdriver: {
server_path: driver
}
}
},
'selenium': {
'port': selenium_port
}
}

Related

why is const being flagged as a syntax error in this javascript?

I am trying to learn to use appium, and running their tutorial test code:
const wdio = require('webdriverio');
const opts = {
port: 4723,
desiredCapabilities: {
platformName: "Android",
platformVersion: "8.0",
deviceName: "Android Emulator",
app: "C:\Users\SStaple\AppData\Local\Android\Sdk/ApiDemos-debug.apk",
automationName: "UiAutomator2"
}
};
const client = wdio.remote(opts);
client
.init()
.click("~App")
.click("~Alert Dialogs")
.back()
.back()
.end();
All I get from running this code is Syntax error in Line:1 Char:1.
I thought const was legal Javascript.
What is going on here?
I am running the code from the Command prompt. I hacve installed the Webdriver in the same folder as the Javascript file.
Your JS file is not a Windows executable, nor is it a script that the Windows command prompt can interpret.
You need to run it using a JavaScript runtime. The most popular one is Node.js.
node appiumTest.js

appium-uiautomator2-server-v0.1.8.apk' exited with code 1" while getting badging info

I am trying to learn Appium, using the instructions given in the documentation:
http://appium.io/docs/en/about-appium/getting-started/?lang=en
I have put this code into a file called AppiumTest.js
const wdio = require('webdriverio');
const opts = {
port: 4723,
desiredCapabilities: {
platformName: "Android",
platformVersion: "8.0",
deviceName: "Pixel_API_26",
app: "C:/Users/SStaple/AppData/Local/Android/Sdk/ApiDemos-debug.apk",
automationName: "UiAutomator2"
}
};
const client = wdio.remote(opts);
client
.init()
.click("~App")
.click("~Alert Dialogs")
.back()
.back()
.end();
I am running it from the Node.js command prompt, using the command: node AppiumTest.js, after starting the Appium Server. It was also necessary to have an Android 8 emulator running.
(Appium Server v1.7.1)
I am getting an output in the Appium Server window. There are a number of errors. The first error shown is this:
Error "Command 'C\:\\Users\\SStaple\\AppData\\Local\\Android\\Sdk\\build-tools\\26.0.2\\aapt.exe d badging C\:\\Users\\SStaple\\AppData\\Local\\Programs\\appium-desktop\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-driver\\uiautomator2\\appium-uiautomator2-server-v0.1.8.apk' exited with code 1" while getting badging info
I have tried running this command on its own in the Command Prompt:
C:\Users\SStaple\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt.exe d badging C:\Users\SStaple\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\uiautomator2\appium-uiautomator2-server-v0.1.8.apk
The result I get here is this:
W/zipro (13656): Error opening archive C:\Users\SStaple\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-uiautomator2-driver\uiautomator2\appium-uiautomator2-server-v0.1.8.apk: Invalid file
ERROR: dump failed because no AndroidManifest.xml found
Any ideas?
Update 28/12/2017 - I found the solution!
The file in question looked suspect. It was 0Kb in size!
I downloaded the apk file from https://github.com/appium/appium-uiautomator2-server/releases and used that instead.
This one is 1,518 KB in size.
(Apparently there is some problem with npm not putting that apk file into the right place while beta is installed.)
Having fixed that, I can move on to the next problem!
Its a known issue with apk signing.
You can start with trying to update dependencies:
npm install appium-uiautomator2-driver
npm install appium-adb
If it didn't help, there is more you can try (but that was for Linux):
modify
./node-v6.11.4-linux-armv7l/lib/node_modules/appium/node_modules/appium-adb/build/lib/tools/apk-signing.js so it would return a true even if it looks not signed.
case 20:
context$1$0.prev = 20;
context$1$0.t0 = context$1$0’catch’;
_loggerJs2[‘default’].debug(“App not signed with debug cert.”);
return context$1$0.abrupt(‘return’, true);

Safari WebDriver setTimeout using protractor exiting

I have done a lot of unit tests using Karma, but my office would like to have some integration tests, especially testing cross browser capabilities. For this, it seemed Protractor was my best option, and I have started get get some basic dashboard tests going, but am stuck with safari.
My Config:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['scenarios/*Scenario.js'],
framework: 'jasmine',
baseUrl: 'https://www-dev.remeeting.com/',
multiCapabilities: [{
browserName: 'firefox'
}, {
browserName: 'chrome'
}, {
browserName: 'safari'
}],
onPrepare: function() {
browser.driver.get('https://www-dev.remeeting.com/');
browser.driver.findElement(by.id('email')).sendKeys('adam+test#mod9.com');
browser.driver.findElement(by.id('password')).sendKeys('abc123');
browser.driver.findElement(by.id('submit_btn')).click();
// Login takes some time, so wait until it's done.
// For the test app's login, we know it's done when it redirects to
// app/#/d.
return browser.driver.wait(function() {
return browser.driver.getCurrentUrl().then(function(url) {
return /app\/#\/d/.test(url);
});
}, 10000);
}
};
My only spec
describe('Dashboard', function() {
it('should login to the dashboard', function() {
expect(element(by.css('.dashboard')).getText()).toMatch(/Upload Meeting/);
expect(element(by.id('refreshButton')));
expect(element(by.css('.dashboard div.btn-group')))
});
});
And the error
[safari #21] PID: 79079
[safari #21] Specs: /Users/adam/git/mrp- www/e2e/scenarios/dashboardScenario.js
[safari #21]
[safari #21] Using the selenium server at http://localhost:4444/wd/hub
[safari #21] ERROR - Unable to start a WebDriver session.
[safari #21] Unknown command: setTimeout (WARNING: The server did not provide any stacktrace information)
...
[safari #21] Driver info: org.openqa.selenium.safari.SafariDriver
[safari #21] Capabilities [{browserName=safari, takesScreenshot=true, javascriptEnabled=true, version=9.1, cssSelectorsEnabled=true, platform=MAC, secureSsl=true}]
[safari #21] Session ID: null
[launcher] Runner process exited unexpectedly with error code: 1
[launcher] 2 instance(s) of WebDriver still running
Anybody know how to configure protractor for safari?
Here is what I did to successfully set up Safari + Protractor:
made sure I have the latest Safari (9.1 at the moment)
downloaded the latest Safari driver from this page, opened the Safari extensions preferences and dragged and dropped the SafariDriver.safariextz file into the extension list:
upgraded protractor to the latest version (3.2.2 at the moment)
Note that, as an alternative, you can always run Safari remotely on BrowserStack or SauceLabs.
See also the list of Safari+Protractor issues.

Protractor with Firefox (32 latest) browser not loading

So for some reason, when I run protractor, Firefox (32 latest) just opens with an empty browser and doesn't navigate to the baseURL. The tests I have written work fine with chrome, but not with firefox. It probably has something to do with the way the conf file is set up. Any ideas?
Conf file:
exports.config = {
allScriptsTimeout: 11000,
specs: [
'e2e/*.js'
],
multiCapabilities: [
{
'browserName': 'firefox'
},
{
'browserName': 'chrome'
}
],
chromeOnly: false,
chromeDriver: 'e2e/chromedriver/',
baseUrl: 'http://localhost:9000/',
framework: 'jasmine',
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
Firefox 32 is broken with selenium <= 2.42.2
UPDATE Selenium 2.43 is out!
Need selenium 2.43 or newer version. Or downgrade Firefox back to version 31 or less.
Issue: https://code.google.com/p/selenium/issues/detail?id=7642
FYI output might look like this:
Using the selenium server at: http://localhost:4444/wd/hub
/home/username/e2e/node_modules/protractor/node_modules/selenium-webdriver/lib/atoms/error.js:109
var template = new Error(this.message);
^
UnknownError: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
003407891246748webdriver-profile/extensions/fxdriver#googlecode.com
1409877425492 addons.xpi DEBUG Ignoring file entry whose name is not a valid add-on ID: /tmp/anonymous7362003407891246748webdriver-profile/extensions/webdriver-staging
1409877425492 addons.xpi DEBUG checkForChanges
1409877425502 addons.xpi DEBUG Directory state JSON differs:........

Node.js Selenium IPv6 Issue (SocketException Protocol family unavailable)

This error only happens when I spawn the ios-driver jar as a Node.js child.
The error is java.net.SocketException: Protocol family unavailable
selenium-test.js:
var spawn = require('child_process').spawn;
var selenium = spawn('java', ['-jar', './ios-server-standalone-0.6.6-SNAPSHOT.jar', '-port', '4444']);
selenium.stderr.setEncoding('utf8');
selenium.stderr.on('data', function (data){
console.log(data);
});
webdriverjs-test.js (webdriverjs)
var webdriverjs = require('webdriverjs');
var options = {
desiredCapabilities: {
browserName: 'safari',
platform: 'OS X 10.9',
version: '7.1',
device: 'iphone'
}
};
webdriverjs
.remote(options)
.init()
.end();
Reproduce this error by creating the above files, running selenium-test.js in one window and webdriverjs-test.js in another window. You will first need to npm install webdriverjs and curl -O http://ios-driver-ci.ebaystratus.com/userContent/ios-server-standalone-0.6.6-SNAPSHOT.jar
Version info:
$ java version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
$ node -v
v0.10.26
Why does this error happen and how do I fix it?
I managed to solve this by making the spawned child ignore stdin:
var selenium = spawn('java', ['-jar', './ios-server-standalone-0.6.6-SNAPSHOT.jar', '-port', '4444'], {stdio: ['ignore', null, null]});
I'm not sure why this workaround works.
I don't have much idea about it, what so far I've found is that this can be binding issue with java. More details is on following link:(It is not the updated information, it may lead to answer)
http://diario.beerensalat.info/2008/10/12/java_and_ipv6_on_bsd.html
If that is not the case, as this post suggests to change it to higher port should work.
"Protocol family unavailable" error while using VisualVM

Categories

Resources