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

Cannot use method TouchAction to process clicking the menu icon in Google page for real Android device #5171

Closed
Lynn907 opened this issue May 27, 2015 · 9 comments

Comments

@Lynn907
Copy link

Lynn907 commented May 27, 2015

Hi,

I use click, and tap method to click the left top corner menu icon in Google Home page for Android 5.0 device, but it's failed.

Here is the method I used. Please help me check the issue and advise the right method to process the action.

driver.navigate().to(https://www.google.com);
driver.context("WEBVIEW_1");
WebElement menu = driver.findElement(By.id("gbg"));
menu.click();
OR:
TouchAction touchAction = new TouchAction(driver);
touchAction.tap(menu).release().perform();

here is the screenshot for menu icon in google page and the screen after clicking the menu icon:
menu
screenaftermenuclicked

@triager triager added the Needs Triage bugs which are not yet confirmed label May 27, 2015
@imurchie
Copy link
Contributor

What does "failed" mean? Can you post the Appium server logs?

@jlipps
Copy link
Member

jlipps commented May 27, 2015

I'm guessing it has to do with the javascript events that the app is listening for not matching those that the atoms are sending

@Anishohri
Copy link

I am facing the similar problem. Can't click on any webview object on chrome browser on any android device.

No error in appium logs. #5015

@imurchie
Copy link
Contributor

For some reason clicking the menu button does not work but clicking "Images" or "Web" does. Strange.

However, you can exit to the NATIVE_APP and then use the TouchAction#tap method, which works.

My test:

    it('should tap the hamburger menu on google.com', function (done) {
      var el;
      driver
        .get('http://google.com')
        .contexts().then(function (ctxs) {
          return driver.context(_.first(ctxs);
        })
        .elementByClassName('android.webkit.WebView')
        .then(function (_el) {
          el = _el;
          var action = new TouchAction(driver);
          return action.tap({x: 50, y: 300}).perform();
        })
        .then(function () {
          return el.elementByAccessibilityId('Maps');
        })
        .click()
        .sleep(3000) // google maps be slow
        .contexts().then(function (ctxs) {
          return driver.context(_.last(ctxs));
        })
        .url().should.eventually.include('https://www.google.com/maps')
        .waitForElementById('ml-searchboxinput').should.eventually.exist
        .nodeify(done);
    });

@Lynn907
Copy link
Author

Lynn907 commented Jun 1, 2015

I have tried with your case. It works. Thanks a lot!:)

@Lynn907 Lynn907 closed this as completed Jun 1, 2015
@Anishohri
Copy link

Yeah X and y works but it doesn't work with Element targets, i did some search and you have a bug already open #4075.

@sebv sebv removed the Needs Triage bugs which are not yet confirmed label Jun 3, 2015
@edison12a
Copy link

I had such an error once, I solved it by...
Make sure that you don't have both of these in your py:

from selenium import webdriver
from appium import webdriver

I had imported both while using selenium explicit waits to find my elements. Never, do so, Its a trap.

@sharma9890
Copy link

sharma9890 commented Jan 31, 2018

not able to click the top right icon
tried
String ContextVaule = driver.getContext();
ChromeDriver driver = new ChromeDriver();
driver.findElement(By.id("menu_button")).click();

also tried via touch action.
id for the menu item is com.android.chrome:id/menu_button
@Lynn907
@imurchie
please help..
Uploading Screen Shot 2018-01-31 at 6.21.04 PM.png…

@lock
Copy link

lock bot commented Apr 24, 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 Apr 24, 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

8 participants