You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
Provide error if locator is not supported by Selenium Server #1632
I'm running my tests for a hybrid app on an Android tablet. After properly configuring the server's capabilities, I kept running into a StaleElementReferenceException. It turns out that this is because by.model doesn't work with Selendroid.
An error should be provided if a locator is not supported.
Oh, that's a fun story, but I'll skip the details :)
Download selendroid and rename it to selendroid.jar for easier typing
Build one of your hybrid apps to make a beautiful little .apk, call it 'app.apk'
Set up your config (see above), where {applicationId} is your application Id (like com.boop.dunks:1234)
Run selendroid. My command-line setup: java -jar selendroid.jar -app app.apk -forceReinstall
If you need more verbosity, do: java -jar selendroid.jar -app app.apk -forceReinstall -verbose -logLevel VERBOSE
Run protractor. In my case, node ./node_modules/protractor/bin/protractor config/spec-e2e.js
You remembered to plug in your device, right? ;)
Two things to keep in mind:
Selendroid doesn't like by.model. I fixed this with:
//Allows by.model with Webdriver
by.model = function(model) {
return by.css('[ng-model="' + model + '"]');
};
Android opens up the keyboard every time you type. It's like your device wants your tests to fail due to soft keyboards getting in the way. Fortunately:
//Takes care of the Android keyboard when doing "sendKeys"
var nativeSendKeys = protractor.WebElement.prototype.sendKeys;
protractor.WebElement.prototype.sendKeys = function(value) {
var result = nativeSendKeys.call(this, value);
browser.actions().sendKeys('\uE100').perform();
return result;
};
Don't yell at me for overriding your library functions, I like not having to refactor tests. :)
I'm not sure there's a general way to address this issue. by.model is using the webdriver protocol execute script behind the scenes, which is (I believe) supported to selendroid, it's just something about the implementation is failing?
We don't test on selendroid at the moment - I think the larger issue here is that Protractor needs to set up some of our test cases with some mobile strategy (figuring out what's at the forefront now - I believe that appium is only using selendroid for older versions (android 2.3-), so I'm not sure if it will feature in our final decision, but this is still pending.
Update: by.model works out of the box with Appium.
If you're considering completely dropping support for Selendroid and focusing on Appium, I would personally recommend against that. In my experience, Selendroid is faster (which is critical on our painfully-slow-running device E2E tests) and Appium has more "hidden" bugs. When testing my app, I've noticed that Appium will fail on clicking certain buttons (the click won't actually go through, but no error is reported) while Selendroid performs the action perfectly.
I understand that supporting two different frameworks for device testing (Appium due to iOS support, Selendroid due to above - hopefully) is far more difficult, but the benefits are far better for us Protractor end users
I think I'm going to close this issue since the original premise isn't something we need to address. However, deciding on better mobile support is definitely on our todos. We've started to clarify the docs, and better support will be coming soon.
Activity
sjelin commentedon Dec 12, 2014
How are you running protractor with selendroid?
mitchhentges commentedon Dec 13, 2014
Oh, that's a fun story, but I'll skip the details :)
com.boop.dunks:1234)java -jar selendroid.jar -app app.apk -forceReinstalljava -jar selendroid.jar -app app.apk -forceReinstall -verbose -logLevel VERBOSEnode ./node_modules/protractor/bin/protractor config/spec-e2e.jsTwo things to keep in mind:
by.model. I fixed this with:Don't yell at me for overriding your library functions, I like not having to refactor tests. :)
juliemr commentedon Dec 13, 2014
I'm not sure there's a general way to address this issue.
by.modelis using the webdriver protocolexecute scriptbehind the scenes, which is (I believe) supported to selendroid, it's just something about the implementation is failing?We don't test on selendroid at the moment - I think the larger issue here is that Protractor needs to set up some of our test cases with some mobile strategy (figuring out what's at the forefront now - I believe that appium is only using selendroid for older versions (android 2.3-), so I'm not sure if it will feature in our final decision, but this is still pending.
mitchhentges commentedon Dec 14, 2014
Update:
by.modelworks out of the box with Appium.If you're considering completely dropping support for Selendroid and focusing on Appium, I would personally recommend against that. In my experience, Selendroid is faster (which is critical on our painfully-slow-running device E2E tests) and Appium has more "hidden" bugs. When testing my app, I've noticed that Appium will fail on clicking certain buttons (the click won't actually go through, but no error is reported) while Selendroid performs the action perfectly.
I understand that supporting two different frameworks for device testing (Appium due to iOS support, Selendroid due to above - hopefully) is far more difficult, but the benefits are far better for us Protractor end users
juliemr commentedon Jan 6, 2015
I think I'm going to close this issue since the original premise isn't something we need to address. However, deciding on better mobile support is definitely on our todos. We've started to clarify the docs, and better support will be coming soon.