i'm using Protractor + Jasmine + Selenium WebdriverJS for automating angularjs application. I was able to configure and setup a sample script with all these tools to run on a desktop computer.
Now I want to run the same scripts on mobile( IOS & Android ) device / emulator.
I'm looking to use appium to run protractor scripts on IOS and Android. If anyone who has worked on protractor and appium. Please help me set up a sample script.
i'm pretty new to all these tools any Info on this is really helpful.
at https://github.com/angular/protractor/blob/master/docs/browser-setup.md you can find very detailed informations how to setup appium with protractor to test on emulators (Android/iOS)
you have to replace the webdriver of protractor with the appium webdriver. the appium webdriver is running normally at port 4723. the folloing code is for android for a web-only angualr app (no apk, pure web, running in the cromebrowser of the device which must be present)
exports.config = {
seleniumAddress: 'http://localhost:4723/wd/hub', //appium
specs: [
'spec.js'
],
capabilities: {
browserName: 'chrome',
'appium-version': '1.0',
platformName: 'Android',
platformVersion: '4.4.2',
deviceName: 'Android Emulator',
},
baseUrl: 'http://yourwebsite.com'),
};
start appium and run test with
protractor yourtest.js
edit: adapting capabilities to recent version (browserName must be present for selenium 2.43.x)
Have you tried using SauceLabs? I think you can request iOS and Android devices by specifying the platform in the capabilities section of the config.
If you don't want to use SauceLabs you can look at using Selenium's Grid functionality. You can get Selenium drivers for iOS and Android and have them connect to a centralized Selenium server that your Protractor scenarios are ran against, you just change the seleniumAddress in your config file to point to the centralized server.
Basically, you have to connect to the devices remotely and the easiest ways are as stated above.
just wanted to share that this configuration worked for me against BrowserStack.-
multiCapabilities: [
{
platformName: 'iOS',
platformVersion: '7.1',
browserName: '',
app: 'safari',
deviceName: 'iPhone Simulator',
'appium-version': "1.4.0",
username: '<username>',
accessKey: '<key>'
}
,
{
platformName: 'Android',
platformVersion: '4.4',
browserName: 'Browser',
deviceName: 'Android Emulator',
'appium-version': "1.4.0",
username: '<username>',
accessKey: '<key>'
}
],
I've found that other values for platformVersion different that the ones that I placed here, does not work, you'll get this error message like: 'Angular was not found....'
I've created a ticket for protractor team and a comment:
https://github.com/angular/protractor/issues/2247
Related
I'm struggling since days with the livereload functionality on my Ionic 5 / Capacitor app. I get on the simulator a white screen after the build is reload, i.e. after a change in the code. When I run the app first time under command "ionic capacitor run ios -l" the app loads perfect in the iOS simulator. After a change in the code I see on CLI that this was compiled successfully. However, in the simulator I stuck on a white screen. I tried many solutions indicated on the web, still having this issue. Is this a known bug on Ionic 5 using capacitor or do you have any idea what could help?
My capacitor config file looks like this:
appId: 'xxxx',
appName: 'xxxx',
webDir: 'www',
bundledWebRuntime: false,
cordova: {
preferences: {
scheme: 'app',
hostname: 'localhost',
ScrollEnabled: 'false',
BackupWebStorage: 'none',
AutoHideSplashScreen: 'false',
SplashMaintainAspectRatio: 'true',
FadeSplashScreenDuration: '200',
SplashShowOnlyFirstTime: 'false',
SplashScreen: 'screen',
SplashScreenDelay: '1000',
loadUrlTimeoutValue: '70000',
ShowSplashScreenSpinner: 'false',
}
}
};
this worked for me:
Option 1: Turn off your VPN if you are using a VPN either on your desktop or your mobile or even both of them.
Option 2: Turn off your windows firewall.
so I am trying to figure out how to config more correctly with mobile and aswell with desktop. Before I explain my issue, I am using this code:
let SpecReporter = require('mochawesome').SpecReporter;
exports.config = {
"browserstackUser": "helloworld",
"browserstackKey": "123456789",
multiCapabilities: [
//{
// browserName: 'Android',
// device: 'Google Pixel 4 XL',
// os_version: '10.0',
// real_mobile: "true",
// project: "Selenium-Test",
// build: "Build T-Hour",
// name: "Pixel 4 XL Android - Happy Flow"
//},
{
browserName: 'Chrome',
device: 'Samsung Galaxy S9 Plus',
os_version: '9.0',
real_mobile: "true",
project: "Selenium-Test",
build: "Build T-Hour",
name: "Samsung Galaxy S9 Plus Chrome - Happy Flow"
}
],
maxSessions: 1,
mochaOpts: {
reporter: "mochawesome",
timeout: 60000,
},
suites: {
all: 'pagesMobile/*.js',
},
framework: 'mocha',
};
As you can see I have different multiCapabilities where I can add on different browsers whenever I want to test.
However my issue is that I do feel like I am doing it incorrectly because I have entered browserName : Chrome to test on however it still does Samsung browser instead and I am not sure what I am doing wrong anymore.
I do feel like I have set it up incorrectly and I am here asking what I am doing wrong that it doesn't want to run Chrome as a browser from Mobile and also if there is someone that is willing to tell me what I can improve aswell.
BrowserStack currently supports only the Chrome Browser on Android and the Safari Browser on iOS real mobile devices. So, your tests on the Samsung Mobile devices should execute on the Chrome Browser by default.
Chrome version: 57.0.2987.110 Chrome web driver: 2.28 Protractor:
5.1.2 Node: 6.9.1
When I run my scripts via protractor I see this error:
ERROR:configuration_policy_handler_list.cc(92)] Unknown policy:
DnsPrefetchingEnabled ERROR:configuration_policy_handler_list.cc(92)]
Unknown policy: PasswordManagerAllowShowPasswords
When I run the similar test case via Java selenium it works fine & does not return error like above.
So I am assuming local group policy is not an issue here but protractor is dealing with web driver in a different way than Java.
I have tried these Chrome options:
'chromeOptions': {
'args': ['incognito','--no-sandbox','--disable-gpu',
'--disable-web-security','--DNS-prefetch-disable']
}
'chromeOptions': {'args': ['lang=en-GB', 'enable-precise-memory-info' , 'js-flags=--expose-gc', 'no-sandbox']}
I'm using this and works perfect for me.
Is protractor compatible with chromeless? If so, how can I configure it?
I didn't find any configuration method online or specific documentation to implement chromeless at protractor configuration.
I'm using protractor 3.1.1
Chrome headless mode is available on Mac and Linux in Chrome 59. Windows support is in Chrome 60.
capabilities: {
'browserName': process.env.PROTRACTOR_BROWSER || 'chrome',
// Using headless Chrome
chromeOptions: {
args: ['--headless', '--disable-gpu', '--start-maximized']
}
}
I'm getting a UnsupportedOperationError: Build info: version: '3.3.1', revision: '5234b32', time: '2017-03-10 09:04:52 -0800' when i run my protractor 5.0.0 tests on safari.
I have a webdriver 2.48.0 extension enabled in safari.
conf file:
capabilities: {
name: 'Safari',
browserName: 'safari',
logName: 'Safari',
shardTestFiles: true,
maxInstances: 2
}
seleniumAddress: 'http://localhost:4444/wd/hub'
I'm starting the server manually by
./node_modules/.bin/webdriver-manager start
and running the spec in a different terminal
Am I supposed to run a specific version of selenium server. Any help would be appreciated.
macOS Sierra with Safari 10.0.2 needs the new Safari Driver. The Safari webdriver 2.48.0 extenson is for Safari 9 and lower.
There are some issues with the new Safari driver, see also here and search Google ;-).
Keep in mind that for example the Wait For Angular doesn't work, to avoid that use browser.ignoreSynchronization = true;