Nightwatch/Chromedriver with Android. Arguments for chrome are completely ignored - android

I'm trying to run some nightwatch tests in my android emulator. My configuration for android in my nightwatch.json looks like follows:
"android" : {
"selenium_port" : 9515,
"selenium_host" : "localhost",
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"androidPackage": "com.android.chrome",
"args": ["--disable-web-security", "--no-first-run"]
}
}
}
The test runs without issues. But I'm always seeing the "First Run Experience" page in each run. Also it is always checking the SSL certificates event when I have set the --disable-web-security flag. Those flags work with Desktop version of Chrome.
I guess this is not an issue with Nightwatch itself. So maybe other implementations of selenium+android would work.
Addtionally, I'm not allowed to use Appium.
Do you know what I'm doing wrong? Have you faced the same issue?

I'm not sure about this spesific case, but passing args to Chrome via the conf file should not include the '--' in the beginning.
So, args: ["some-option"] instead of args: ["--some-option"] makes the difference in my setups.

You can use the below configuration for mobile emulation in the Chrome web browser:
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"mobileEmulation": { "deviceName" : "Galaxy S5"},
"args": [
"disable-web-security"
]
}
},

Related

How to configure CodeceptJs to work with appium for website testing on mobile device

hope you are well, I am trying to configure Codeceptjs to work with Appium, for proof of concept I only need the configuration to naviagte to a website amazon.com for example and create an account.
I have been reading the appium documentation and the following is stated for Chrome on Andriod 'For web tests, to automate Chrome instead of your own application, leave the app capability empty and instead set the browserName capability to Chrome.' Can be found here https://appium.io/docs/en/drivers/android-uiautomator2/
So I have left 'app' blank as it tells me to do, but every time i run my test I get the following error
Error: Failed to create session.
An unknown server-side error occurred while processing the command. Original error: 'app' option is required for reinstall
My config is as follows, I have been changing settings for the past few days with no luck, any help or pointing me in the right direction would be really appreciated, thank you in advance.
```exports.config = {
tests: './*_test.js',
output: './output',
helpers: {
// WebDriver: {
// url: 'https',
//browser: 'chrome'
// },
Appium: {
path: '/wd/hub',
port: 4723,
platform: 'Android',
url: 'https://www.test.com',
desiredCapabilities:{
deviceName: "emulator-5554",
platformVersion: "11.0",
platformName: 'Android',
deviceName: 'Android Emulator',
automationName: 'UIAutomator2',
browserName: 'Chrome'
}
}
},
include: {
I: './steps_file.js'
},
bootstrap: null,
mocha: {},
name: 'CodeceptJS',
plugins: {
wdio: {
enabled: true,
services: ['selenium-standalone']
},
pauseOnFail: {},
retryFailedStep: {
enabled: true
},
tryTo: {
enabled: true
},
screenshotOnFail: {
enabled: true
}
}
} ```
Configuration issue on my end, incompatable chrome browser version to to the chrome driver, has been resloved with a simple appium command

Reading build config file build.json freezes while cordova run android. #Cordova-developers: Any ideas?

I'm setting up my first hybrid app using cordova / framework7-cli....
all fine, except
cordova run android
freezes with:
"Reading build config file: C:\...\APP\build.json . . . . . . "
and many many more dots.
Tried to
1. cordova build android --release
2. Moved build.json, take a look inside, ok...
3. built a new apk, built a new session, tried another avd ...
build.json:
{
"ios": {
"release": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
},
"development": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
},
"debug": {
"buildFlag": [
"-UseModernBuildSystem=0"
]
}
}
}
However, this freeze causes to break my build-process and nothing happens. normally i can see my app on the selected device...
Does anybody got the same issue?
If using Android Virtual Device make sure to run "Cold Boot Now". This fixed the issue for me

Selenium grid with appium android and protractor configuration

I've got a selenium grid with chrome, firefox and android node running
and I have this protractor configuration within an angular cli project:
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const {SpecReporter} = require('jasmine-spec-reporter');
var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');
var screenshotReporter = new HtmlScreenshotReporter({
dest: 'target/screenshots',
filename: 'my-report.html'
});
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
multiCapabilities: [{
'browserName': 'chrome'
}, {
'browserName': 'firefox'
}, {
'browserName': 'android',
'platformName': 'Android',
'platformVersion': '7.1.1',
'deviceName': 'Nexus 5'
}],
// directConnect: true,
seleniumAddress: "http://localhost:4444/wd/hub",
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function () {
}
},
beforeLaunch: function () {
return new Promise(function (resolve) {
screenshotReporter.beforeLaunch(resolve);
});
},
onPrepare: function () {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true}}));
jasmine.getEnv().addReporter(screenshotReporter);
},
afterLaunch: function (exitCode) {
return new Promise(function (resolve) {
screenshotReporter.afterLaunch(resolve.bind(this, exitCode));
})
}
};
When I launch my ng e2e task, tests are running fine on firefox and chrome node. However, I've got this error coming from the android capability:
WebDriverError: An unknown server-side error occurred while processing the command. Original error: The desired capabilities must include either an app, appPackage or browserName
...
If I get it right the android webdriver asks me to include a browserName although I already provide it one. Does anyone have an idea?
the andriod capability in your protractor config file will failed to get any matched node for you. Because you use one wrong name and one wrong value in capability.
you use 'platformVersion', but on selenium gird is 'version'.
you set 'deviceName' to 'Nexus 5', but on selenium gird is 'nexus_5_7.1.1'
please change 'platformVersion' to 'version' and correct 'Nexus 5' to 'nexus_5_7.1.1' in your protractor config file, then try again.
My last concern is on your selenium grid the browserName is 'android', I'm not sure testing can open the browser.
In most case, we install Chrome on andriod device and set browserName to 'Chrome' when register device to selenium grid and in protractor config file.
I indeed not know 'andriod' represents which browser, the build-in browser bind with andriod OS?

Typescript sourcemaps not displayed in Ionic 2 on an Android device

I face a weird Ionic2 behaviour.
When i deploy my app to a simulator, i can see the .ts file sourceMap in the chrome inspect debugger.
On both case, i use :
ionic run android
On the other side, when i deploy my apk on a real device, the tab "Sources" is completely different with an other groups of directories and, with no reference to my .ts files.
My environment is:
OS X 10.11
Ionic 2 2.0.0-beta.35
cordova 6.3.0
The project has been initially generated by:
ionic start biblio tutorial --v2
ionic.config.json
{
"name": "biblio",
"app_id": "",
"v2": true,
"typescript": true
}
tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"filesGlob": [
"**/*.ts",
"!node_modules/**/*"
],
"exclude": [
"node_modules",
"typings/global",
"typings/global.d.ts"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
Any ideas?
For me the problem was that when you're remote debugging on an android device, Chrome debugger cannot access the source map file on the device. The solution/fix is to include the source map inline. To do this I:
added the below to package.json in the root project directory
"config": {
"ionic_bundler": "webpack",
"ionic_source_map_type": "#inline-source-map"
},
This is to make the webpack to add source maps inline changed tsconfig.js line
"sourceMap": true,
to
"sourceMap": false
This is to disable typescript to create source map file since this is done by webpack.
After this change everything seems to be working fine. Note that this applies to ionic 2 RC_04

Appium can't find 'appPackage' parameter

I'm trying to run simple RSpec test on real Android device using Appium. My config is:
apk = {
device: :android,
app_path: *path_to_apk*,
app_package: *app_package*,
app_activity: '.Start'
}
Then I'm starting driver by:
Appium::Driver.new(apk).start_driver
Script fails with error:
Selenium::WebDriver::Error::WebDriverError: Parameter 'appActivity' is
required for launching application
I tried to debug by steps and found out, that in Selenium::WebDriver::Remote::Http::Default inside request method script sends post request with path: "/wd/hub/session" and body: {"desiredCapabilities":{"platform":"OS X 10.9","platformName":"android","name":"Ruby Console iOS Appium","device-orientation":"portrait","app":*path_to_apk*}}. The response is HTTPInternalServerError object with body:
"{ "status": 33, "value": {
"message": "A new session could not be created. (Original error: Parameter 'appActivity' is required for launching application)",
"origValue": "Parameter 'appActivity' is required for launching application" }, "sessionId": null }"
I can't understand what's the problem and find any solutions in google. Maybe value of 'app_package' parameter is wrong? So my second question is how can I get it?
P.S. Before all, appium was run in terminal by command appium & and started successfully
How to get app package?
Answer: Open 'Dev Tools' in emulator/device, then go to package browser then select your application , there you will get the app package along with available activities.
What is the problem with your code:
Ensure to include these stuffs:
platformName: 'Android',
appActivity: '.activity_name',
appPackage: 'package_name'

Categories

Resources