Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clicks on elements don't work properly on iPad and iPhone 10.0+ in landscape mode #6994

Closed
mykola-mokhnach opened this issue Oct 12, 2016 · 39 comments

Comments

@mykola-mokhnach
Copy link
Collaborator

The problem

Triggering WebElement->click method on iPad 10.0 simulator in landscape mode does work properly and always clicks at wrong location. At the same time it works as expected in portrait mode.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.6.0 @ XCUITest
  • Last Appium version that did not exhibit the issue (if applicable):
  • Desktop OS/version used to run Appium: 10.11
  • Node.js version (unless using Appium.app|exe): 5.4.1
  • Mobile platform/version under test: iOS 10.0
  • Real device or emulator/simulator: iPad Air Simulator
  • Appium CLI or Appium.app|exe: CLI

Details

This is, most likely, bug in XCTest framework itself and I have already reported it to Apple bugtracker, but, probably, we can introduce a workaround or add it to the official documentation as known issue. Although, the described problem is not reproducible in iPad simulator 9.3. It only started to fail after I upgraded Xcode to version 8.0. It looks like XCTest always assumes we are in portrait mode and calculates wrong coordinates for clicking.
I've tried to directly call WDA methods like setOrientation and setRotation, but neither of them helps to workaround the problem.
Reference to the other known issue: facebookarchive/WebDriverAgent#300

Code To Reproduce Issue [ Good To Have ]

driver.rotate(ScreenOrientation.LANDSCAPE);
WebElement el = driver.getElement(locator);
el.click()
@triager triager added the Needs Triage bugs which are not yet confirmed label Oct 12, 2016
@mmuntakim15
Copy link

@mykola-mokhnach I'm having the same issue with our app, unfortunately our app only supports iPad landscape mode therefore we were unable to run any tests since the xcode 8.0 upgrade. As you mentioned it worked fine before the upgrade.

@michaelBurko
Copy link

I have exactly the same issue with my app in the landscape mode. Works fine in portrait though.

@mykola-mokhnach
Copy link
Collaborator Author

What is actually possible, we can intercept all calls to click and other similar methods in an inherited AppiumDriver instance, translate coordinates manually for landscape mode only and then execute click by coordinates instead. But i's going to be slow and lousy way of doing things %/

@qakapil
Copy link

qakapil commented Oct 18, 2016

This is really turning out to be a blocking issue for me as I am trying to automate a video player app which always is launched on Landscape view. Hardcoding elements x-y co-ordinates could be one workaround but not sure how viable it is as we run our tests across a combination of different devices.

@mykola-mokhnach
Copy link
Collaborator Author

@imurchie Could you please add this to the list of known issues in the official documentation?

@BogdanVovk
Copy link

I am experiencing same issue. I have been trying to set coordinates manually for landscape mode, but it's really annoying and I couldn't not use tests for cross devices testing. Do you have an idea when it's going to be fixed?

@joshrlesch
Copy link

joshrlesch commented Oct 20, 2016

I am seeing this on iphone also. This issue might also be related appium/appium-xcuitest-driver#209

@mykola-mokhnach mykola-mokhnach changed the title Clicks on elements don't work properly on iPad 10.0+ in landscape mode Clicks on elements don't work properly on iPad and iPhone 10.0+ in landscape mode Oct 20, 2016
@mmuntakim15
Copy link

@imurchie Would this issue be part on 1.6.1? this is blocking us with all our tests since our app only supports Landscape mode :(

@pavanbachu0604
Copy link

@joshrlesch :any idea why is this thread closed ?

@maesiva
Copy link

maesiva commented Nov 18, 2016

My app too switches to landscape on launch. Same observation in 1.6.1 beta. It clicks at wrong location and if I force my app to portrait in it's code, click/sendkey/tap work well. Unfortunately, my app is supposed to be tested on Ls and eagerly waiting for the fix.

https://discuss.appium.io/t/ios-10-hybrid-app-webview-tap-with-offset-not-working/13025/2

@imurchie
Copy link
Contributor

We are eagerly awaiting a fix too. Apple is aware of the problem.

@mykola-mokhnach
Copy link
Collaborator Author

The issue seems to be fixed in the most recent WDA master branch. Just update the submodule for the upcoming Appium release

@gopi09m
Copy link

gopi09m commented Nov 30, 2016

@mykola-mokhnach I have updated to Appium 1.6.1 today and i still see this issue. Do we still need to update dependencies ? I had it done when 1.6.0 was installed. Even if i ran bootstrap.sh now it just doesn't show any updates except "fetching dependencies". Is there a way to clean the dependencies and get them again if required?

@mykola-mokhnach
Copy link
Collaborator Author

@gopi09m Appium update won't help, since 1.6.1 does not include the source needed to fix the problem. Either update the webdriver sources manually or wait until Appium 1.6.2 is released.

@gopi09m
Copy link

gopi09m commented Dec 2, 2016

Can you let me know how do i update WDA master branch alone ? Download and Copy the code folder manually ? Or is there a npm command for that ?

I downloaded it from : https://github.com/facebook/WebDriverAgent and
Copied it to /Users/automation/node_modules/appium-xcuitest-driver/. And fetched dependencies again. It worked for me in landscape mode. :-) I copied the bundle i got from1.6.1 for new WDA project copied from git.

@jlipps
Copy link
Member

jlipps commented Dec 2, 2016

1.6.2 is released now, so I'd just try that

@jlipps jlipps closed this as completed Dec 2, 2016
@maesiva
Copy link

maesiva commented Dec 5, 2016

Jonathan, Thanks for the update. I appreciate your continuous efforts and support.

I could install 1.6.2. However, my test execution is stuck at:
"iPad XCTRunner[367] : Continuing to run tests in the background with task ID 1"

I see that my application and WebDriverAgent get installed and the WebDriverAgent starts and .. nothing .. App doesn't launch.

I ensured that WebDriverAgent is signed and my application.app works. Am I missing something else?
Gist: https://gist.github.com/maesiva/1ce315bc6eae682cffcb4f59785b94a8

@jlipps
Copy link
Member

jlipps commented Dec 5, 2016

@maesiva looks like the same issue as #7357 so we'll track it there

@kommuswamy
Copy link

Hi @jlipps ,

I have updated the appium version to 1.6.2. After updating the appium i am facing an issue while launching simulator like killing all simulator.

Thanks.

@mzvuluni
Copy link

Hi, We are seeing this issue using iOS 9 only, seems like the issue is resolved is iOS 10.
Using WDA 2.4.2

@mykola-mokhnach
Copy link
Collaborator Author

mykola-mokhnach commented Dec 15, 2016

@mzvuluni facebookarchive/WebDriverAgent#411 should fix the issue. The problem is, that XCTest returns correct location in landscape mode for elements in 9.3, but this was broken in 10.0+
WDA itself has implemented has a workaround, but didn't count that, so click in landscape works for 10.0+, but is broken in 9.3

@mzvuluni
Copy link

@mykola-mokhnach thanks for that.
So i guess that we will wait for the fix then.

@maesiva
Copy link

maesiva commented Dec 23, 2016

Verified on 1.6.3 on iOS 10.0.2 and XCode 8.
Good to see that app launch issue (#7357) is fixed.

But, landscape mode click issue still persists. Clicks work for some elements if dynamic id locators are used (ext-element-xx .. ) though. Yet won't be able to proceed with my app tests.

Hoping to see the fix (facebookarchive/WebDriverAgent#411) after Christmas.

@maesiva
Copy link

maesiva commented Jan 26, 2017

Good to see that the fix (facebookarchive/WebDriverAgent#411) is merged. Would love to see it working in the next Appium release.

@imurchie
Copy link
Contributor

You can use it now if you upgrade to appium-xcuitest-driver@2.5.4.

@maesiva
Copy link

maesiva commented Feb 1, 2017

@imurchie, I updated the xcuitest-driver to 2.5.4 by "npm install -g appium-xcuitest-driver@2.5.4".

/usr/local/lib
└─┬ appium-xcuitest-driver@2.5.4 
  └── appium-base-driver@2.1.6 

But, when I run the test code with Appium, I see the log:

[debug] [XCUITest] XCUITestDriver version: 2.4.2

And, the landscape issue persists, as I guess its still using the older version of xcuitest-driver.
Please let me know how to configure the appium to use the upgraded xcuitest-driver.

@imurchie
Copy link
Contributor

imurchie commented Feb 1, 2017

@maesiva You need to install it within the Appium installation for it to work. Or you can re-install the whole thing with npm uninstall -g appium && npm install -g appium --no-shrinkwrap.

@vikramvi
Copy link
Contributor

vikramvi commented Feb 1, 2017

For those who refer above & are wondering what is --no-shrinkwrap
https://discuss.appium.io/t/upgrade-appium-client-to-latest-appium-version/6054/21
http://blog.npmjs.org/page/2

@maesiva
Copy link

maesiva commented Feb 1, 2017

@imurchie Thanks for the installation instruction. I could install Appium with latest xcuitest-driver.
During execution I could see the XCUIT driver version: 2.6.0.

[debug] [XCUITest] XCUITestDriver version: 2.6.0

However, I am still facing the Landscape issue. Is driver version supposed to be 2.5.4 ?

And, like earlier, SendKeys() / Click() work, if I use the dynamic ids .. like "ext-element-24". but, I can't rely on it, as the dynamic IDs tend to change often.

Test Code and Appium server logs shared on gist here:
https://gist.github.com/maesiva/db47d4b9fccdabd43e406b08bcb55abe

I appreciate your continuous support and help.

@mykola-mokhnach
Copy link
Collaborator Author

@maesiva Check the device log. Probably, you experience this bug, because I see timeout in the log

@maesiva
Copy link

maesiva commented Feb 1, 2017

If I call driver.getPageSource() before SendKeys:
System.out.println("\n\n" + driver.getPageSource() + "\n\n");
I can see the page source printed on the console with all the hierarchy.

And, if I use regular ID for id field and dynamic ID for Password field, I could see the password is typed in while execution, but not the id field.

        driver.findElement(By.id("loginid")).sendKeys("user22"); // ext-element-24 , loginid 
        driver.findElement(By.id("ext-element-30")).sendKeys("pwd22"); // ext-element-30 , password 

Please let me know if I can dig in any further.

@maesiva
Copy link

maesiva commented Feb 17, 2017

@mykola-mokhnach
Tried with Appium 1.6.4 beta, which uses XCUITestDriver version 2.9.0

No luck.. Server logs show 200 for all 3 element sendkey/clicks.. But, on screen, no ui action is observed.

My application is Cordova based hybrid app and runs in Landscape mode. I'm using iPad Mini 4 with iOS 10.0.2 (MK9J2CL/A)

Can you please help me in getting through the Click/SendKeys ? I've been stuck with the issue ever since Dev team upgraded to XCode 8.x and I moved to Appium 1.6.. due to the notorious introduction of XCUITest by Apple.
Is facebookarchive/WebDriverAgent#411 tested for my environment?
Its sad to see that I'm unable to make use of the best automation tool out there on the web for my project testing.

I appreciate any hints / workarounds / offset approaches. Please let me know if any logs or further information is required.

@mykola-mokhnach
Copy link
Collaborator Author

@maesiva Sorry, I don't have physical capability and time to investigate the thing for all possible cases. I'm doing the stuff as a non-paid contributor and testing these workarounds in our local environment, that Wire uses for automated testing.
I think everyone would appreciate it if you can test it on your local env and contribute the necessary fixes to WDA source yourself.

@nvorontsov
Copy link

I've got the same issue. Our app only supports landscape. At the moment I can not execute any testcases.

@fionazj
Copy link

fionazj commented Mar 17, 2017

Is there any update for this problem?
I'm facing same issues...After my Appium is upgraded to 1.6.4 Beta with IOS10, some buttons cannot be clicked in simulator of Ipad in portrait mode.
In 1.5.3 with Xcode 9.3 it works fine
Appium log doesn't log any errors...

@PrabhatPandey
Copy link

PrabhatPandey commented May 17, 2017

I was having the same issue in iOS 9 devices.
I have solved the clicking problem by implementing the tap() method which taps on the element.
This works on both landscape and portrait. On real devices and on simulators too.

Here is the code sample code.

    @Test
public void testIfTheBannerAdIsGettingLoadedWhenWeRequestTheAppToLoadBannerAdInLandscapeMode() {IosTestingUtility.rotateTheScreenToThisOrientation(driver,ScreenOrientation.LANDSCAPE);

	WebElement element = driver.findElement(By.id("Load Ad"));

	tapOn(element,driver);

	TestCase.assertEquals(true,driver.findElement(By.id("Ad did load")).isDisplayed());
   assertEquals(true,BannerTextUtility.checkIfTheBannerTextAdContentAreBeingShown(driver));}

`

Here is the method :
public static void tapOn(WebElement element,AppiumDriver driver){ new TouchAction((MobileDriver) driver).tap(element).perform(); }

@testPK
Copy link

testPK commented May 4, 2018

I am having this same issue. Appium - v1.7.2
XCUITTestDriver v2.64.0 and Xcode version 9.2.
Tried using AppiumLibrary.

@AsteaDevelopment
Copy link

Just want to make everyone aware that this is still an issue using iOS 12 on an iPad. We will investigate the issue further when we get a chance.

@lock
Copy link

lock bot commented Oct 17, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Oct 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests