Help Please.
I use:win 7, ruby 2.0.0, appium 1.3.7.0
I test android app.
In test suite, in my steps I define:
Appium.back
I try tap on hardware(native) button e.g. back, home.
but if I run test, appears next error :
NoMethodError: undefined method 'back' for Appium:Module
ansver to my question
in env.rb write
$capy_driver = Capybara.current_session.driver
and use in steps
$capy_driver.go_back
or
$capy_driver.appium_driver.press_keycode 4
Related
I'm using Appium 1.6.5 and Windows 10.
Using the demo app by Appium (ApiDemos-debug.apk), I am trying to drag and drop dots.
View app screen:
This is my current code:
TouchAction actions = new TouchAction(driver);
actions.tap((AndroidElement)driver.findElementByAndroidUIAutomator("text(\"Views\")")).perform();
driver.findElementByAndroidUIAutomator("text(\"Drag and Drop\")").click();
AndroidElement element1 = driver.findElement(By.id("io.appium.android.apis:id/drag_dot_1"));
AndroidElement element2 = driver.findElement(By.id("io.appium.android.apis:id/drag_dot_2"));
actions.longPress(element1).waitAction(3000).perform().release();
This error prints when test is run:
org.openqa.selenium.NoSuchElementException: An element could not be
located on the page using the given search parameters. (WARNING: The
server did not provide any stacktrace information)
Any combination of longPress() calls results in this error. I can click & tap, that's fine. When it comes to using other TouchAction methods, then errors occur.
Any idea how to resolve this? Need to know if it's my setup that's wrong or TouchAction method has issues.
You need to long press on that element and drag it to other element.Currently, you're only pressing long and performing the action without releasing it.
Try this:
actions.longPress(element1).moveTo(element2).release().perform();
I am using the Ionic Framework to build a mobile app for Android/iOS. I was able
to build the project for android (ionic build android). When I run the app, it will be only a white screen, that's because there is an error (when you use GapDebug, you can run apps on your phone and you will be able to debug, and see errors). Now if I run it on the desktop browser there really is NO error and everything is working. Below is the error that is shown in GapDebug:
Now when you check the code in service.js line 394:
There's nothing wrong with the code right? If I try to change line 394 to something like key : self.currentUser, there will be NO error and the app will work. What seems to be the problem here?
Not sure why you are making an object's attribute a list? If you want the key to be childQuestionSnapshot.key then remove the square brackets.
If you are trying to update a list of objects, you can do something similar to the below:
var test = [{key: 'thisguy'},{key: 'thatguy'},{key: 'myguy'}]
test.forEach(function(item){
item['key']='newguy'
})
console.log(test)
Do this instead
var updateObj = {};
updateObj[childQuestionSnapshot.key] = self.currentUser;
applicantRef.update(updateObj, function() {
console.log("applicant answers updated");
});
I am trying to test a hybrid app (created with ionic cordova) with calabash.
I am not able to see any elements in the console. Any query statement returns [] Below is the code snippet of what I did. Let me know what is wrong.
D:\ionicProject\todo\platforms\android\build\outputs\apk>calabash-androi
d console android-debug.apk ADB_DEVICE_ARG=emulator-5554
Starting calabash-android console...
Loading C:/Ruby21/lib/ruby/gems/2.1.0/gems/calabash-android-0.5.15/irbrc
Running irb...
*** WARNING: You must use ANSICON 1.31 or higher (https://github.com/adoxa/ansic
on/) to get coloured output on Windows
irb(main):001:0> start_test_server_in_background
nil
irb(main):002:0> query("webView css:'*'")
[]
irb(main):003:0> query("CordovaWebView css:'*'")
[]
First simply use query('*') and see all the result.
Then find all the element with class using
query('*', :class)
Then find all the element with class using
query('*',:id)
If you want to display only text content
query('*', :textContent)
if you know the correct view (ie webview or systemview) You can use that view name instead of *
Need to use SystemWebView instead of CordovaWebView
Example:
query("SystemWebView css:'*'")
I Question the stackFlow member. "How to make 'When I press the Android Widget the Button To run at the same time'?"
I like to run at the same time. but When I make the Android code, I was failed. Because I use same switch Grammer. I don't know the code.
I want [ 1. press the button 2. Activity -> 'the other Activity' and 'To runn the Download Manager'
' algorithm -> Android Java code ' please tell me. Thanks.
Can I press back button of android emulator using selenium web driver?
Looking for help.
I was using Selenium with Appium and Android emulator, succeeded with
webdriver.navigate().back();
Run the below command from my java class.
It helps me to press back button.
Runtime.getRuntime().exec("cmd /K cd " +"../libs/android-sdk-windows/platform-tools");
Runtime.getRuntime().exec("cmd /C adb shell input keyevent 4");
Hope it will help others
I've got the following assumtion:
as we have such mapping
**Emulated Device Key** -**Keyboard Key**:
Home - HOME;
Menu (left softkey) - F2 or Page-up button;
Star (right softkey) - Shift-F2 or Page Down;
Back - ESC;
Try to emulate sending 'esc' key.
element.sendKeys(Keys.ESCAPE)
If you wanna handle some popup (e.g. alert or confirm dialog box) and do not have any possibility to localize element prolly this works:
Alert a = driver.switchTo().alert();
a.confirm(); // or dismiss() if you want to hit 'cancel'
Hope this helps you)