Codeceptjs swipe function - appium

Im just working with codeceptjs and using appium driver for testing android application.
Now i have different issues with this framework. Im currently working for a test, where i have to use swipeLeft, but it isnt working, there is nothing happen when that function is calling, also swipe, swipeRight, swipeUp, swipeDown. Has anyone already solved this problem or can i use alternatively a back() function or something?

Use the following syntax to make your code work:
I.executeScript('mobile: swipe', {direction: 'left'});

Have you consider Touch Perform (or Action) ? It is working for me

I have used webdriverio and it seems like Codeceptjs have similarities with their implementations of appium methods for mobile automation.
Are you testing using Android or iOS device?
Have you tried using different method overrides for Swipes?
On my experience, iOS and Android have different Speed and Offset settings you need to adjust the values until you get the swipe action working.
And of course you need to make sure you are selecting the appropriate View/Slider/Element that is scrollable, otherwise swipe will fail.
https://codecept.io/helpers/Appium

Related

"Cached element do not exists in DOM" when run Appium with Robot Framework

I'm working on automated test using Appium with Robot framework on Android device. I create schedule run on Jenkins. My test flow is entering some data in page A and submit, then switch to page B to check the result and switch to page A to enter a new data. I repeat this loop for around 10+ time. Everything works fine in around 4-5 rounds but after that there show up an error :
StaleElementReferenceException: Message: Cached element 'By.xpath:
//android.widget.TextView[#text='Limit']' do not exists in DOM anymore
The TextView is in the page A. I monitored the robot and saw that the TextView was shown up but the robot did not see it. I tried restart the device but the problem is not solved. I search through the internet and found some who facing the same issue but they use different programming language like Java or Python. I have no idea what I have to do next.
Development Tools :
Appium version: 1.21.0
Robot Framework version: 4.1.2 (Python 3.10.0 on win32)
First I do not use Robot Framework, but the code should be similar according to this https://robocorp.com/docs/languages-and-frameworks/robot-framework/try-except-finally-exception-catching-and-handling.
Second, I'm not sure if this is the best way to get around this. I think there is something you can do with the expected conditions class to get around this in a "cleaner way" but I'm not quite familiar with it enough to show/tell you. Instead what I've done is something like this...
from selenium.common.exceptions import StaleElementReferenceException
while some_limiting_factor:
try:
# logic for submitting page A, assertions for page B
except StaleElementReferenceException:
element = driver.find_element('By.xpath: //android.widget.TextView[#text='Limit']' )
As much as I want to cache elements in appium, it seems that the service itself does NOT want you to, at least not in my experience. Getting a fresh element(s) every time seems to ensure a "slow but steady" test. Hopefully someone can show me the deep appium secrets one day.

How to Automate selecting values in a iOS PickerWheel with Ruby

I have been automating an application with Ruby and the Cucumber Framework. I'm utilizing XCUITest for my iOS automation within this framework.
From what research I've done it appears as though I have to send text to the picker wheel for it to adjust to the wanted value. This is the code I've tried to use:
Then(/^I click on month"([^"]*)"$/) do |month_number|
find_element(xpath: "//XCUIElementTypePickerWheel[1]").adjustToPickerWheelValue("#{month_number}")
end
With this code my Cucumber framework calls the find_element method for that element and attempts to send the "month_number" value to a "adjustToPickerWheelValue" method.
The error I receive when I attempt to use this method is a standard noMethod error:
undefined method `adjustToPickerWheelValue' for #<Selenium::WebDriver::Element:0x007f802cda98d8> (NoMethodError)
Is there something special I need to do to call this method in my env.rb file? Right now I just have "appium_lib" as required. Is there an XCUITest library I need to be utilizing as well?
Any and all help would be greatly appreciated. I'm very new to automating iOS. Thanks for reading and I hope to hear from you soon.
The method for xcuitest is
select_picker_wheel(element:, order:, offset: nil)

How to access Webview in appium python for iOS hybrid apps

Tried with
handle = self.driver.window_handles[0]
self.driver.switch_to_window(handle)
on emulator, but no luck. I am not able to access / manipulate the elements in the page. I don't even know if i got switched to web view.
Any suggestions on how to use web views on iOS with appium (python) ?
driver.window_handles[0]is probably the current window - try inspecting window_handles to see what other windows are available. On iOS, the app that I test just has window handles like '1', '2', etc, and switching to the last element of window_handles usually does the trick.
Please use the below code to switch to WebView , if you are using appium 1.0
self.driver.switch_to.context('WEBVIEW');

"Rubber band" events on phonegap app

I'm working on an iOS app using Phonegap/ Cordova and jQuery Mobile.
I want to be able to refresh the data when the user pulls the page down (rubber band effect). I tried using iScroll 4 but it made scrolling my page slow.
I didn't find a phonegap plugin for this. I thought this was a pretty standard iOS feature so maybe I am missing something? Is there any easy way to listen to the pull down event using phonegap / cordova?
Thanks!
Adding this line into CDVViewController.m (Cordova 2.0 or later) is said to work but I've actually never tried it myself as I'm still using iScroll 4. Give it a shot and let me know how it worked for you.
[webView.scrollView setDecelerationRate:UIScrollViewDecelerationRateNormal];
Likewise, however somewhat irrelevant to this matter, the code snippet below is said to reduce the on click delay from 300 ms which is also something phonegap developers usually want. Neither this nor the line above has been properly tested but perhaps a good way to start off.
[webView.scrollView setDelaysContentTouches:NO];

AIR for Mobile: how to debug MultiTouch?

Is there any way to simulate touch events in ADL? If not, how do you properly debug an application that heavily relies on touch events?
Using a device seems to be the best way, though it also appears this overlaps a previous SO question that describes the same issue in the normal Android Emulator: Is there any way to test multi-touch on the Android Emulator?
Also with regard to code testing you can still write unit tests to test out your objects/methods and verify they have the appropriate input and output. If you're so inclined as to do so you could even have it dispatch events from UI components using code like
//in your code
Multitouch.inputMode=MultitouchInputMode.GESTURE;
someComponent.addEventListener(GestureEvent.GESTURE_TWO_FINGER_TAP, someHandler);
//and in your test
someComponent.dispatchEvent(new GestureEvent(GestureEvent.GESTURE_TWO_FINGER_TAP));
//verify appropriate change occured after a timeout or something of that nature
and should be able to get the appropriate reaction to the event.
more on gesture events here:
http://help.adobe.com/en_US/as3/dev/WS1ca064e08d7aa93023c59dfc1257b16a3d6-7ffd.html
more on multi-touch/gestures here as well:
http://www.adobe.com/devnet/flash/articles/multitouch_gestures.html
You can create multitouch app , run it on Your mobile and send Touch from device using WIFI .
This is how Im testing this .
But You can also write emulator that will read MouseEvents from stage and dispatch TouchEvents .

Resources