robotframework-appiumlibrary icon indicating copy to clipboard operation
robotframework-appiumlibrary copied to clipboard

No keyword to swipe delete for iOS

Open SamyQAZ opened this issue 7 years ago • 4 comments

Trying to delete phone book contact, which require swipe to left and delete.

Used Swipe and swipe by percent seems both doesn't worked.

Is there a way to test delete on iOS?

SamyQAZ avatar Feb 09 '18 07:02 SamyQAZ

def Hide_cuirte(cuirte): platformName=BuiltIn().get_variable_value("${current_device.platformName}") cuirte_size = BuiltIn().run_keyword("get element size", cuirte) cuirte_position = BuiltIn().run_keyword("get element location", cuirte) start_x = cuirte_size["width"]+cuirte_position["x"] start_y = cuirte_size["height"]/2+cuirte_position["y"] ofset_x = -cuirte_size["width"] ofset_y = 0 BuiltIn().log("startX "+str(start_x)+" ofsetX "+str(ofset_x)+" startY "+str(start_y)+" ofsetY "+str(ofset_y))
if platformName=="iOS": BuiltIn().run_keyword("Swipe",start_x,start_y,ofset_x,ofset_y,0) else: BuiltIn().run_keyword("Swipe",start_x,start_y,start_x+ofset_x,start_y+ofset_y)

I develop this function with python. The cuirte argument is the item locator you want to delete. The swipe is not the for iOS (ofsetX) and Android (endX).

lolotoms avatar Mar 02 '18 16:03 lolotoms

Already figured it out. Swipe with coordinates work as charm. No need to write anything in python and call with RFramework

Just use Swipe XX YY XX YY Click Element ${delete}

SamyQAZ avatar May 30 '18 07:05 SamyQAZ

@SamyQAZ, There is problems with this coordinates swipe. If you have to test few devices with different size screen, this swipe doesn' t work all the time but just with the devices which have the good resolution. I wrote this function to adapt swipe for all the resolutions. It is based on element reference instead of coordinates reference.

lolotoms avatar Jun 09 '18 10:06 lolotoms

@lolotoms Thanks, i will try it. Hope it helps

SamyQAZ avatar Jun 13 '18 10:06 SamyQAZ

Please check new execute_script refer to #363

serhatbolsu avatar Oct 26 '22 09:10 serhatbolsu