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

Not able to do any actions on ui controls of my iPad app on real device using Appium 1.6 #7306

Closed
gopi09m opened this issue Nov 28, 2016 · 2 comments

Comments

@gopi09m
Copy link

gopi09m commented Nov 28, 2016

Description

Unable to click/tap on a label or uiastatictext field using appium 1.6

Environment

java client build version or git revision if you use some shapshot: 1.8
Appium server version or git revision if you use some shapshot: 1.6
Desktop OS/version used to run Appium if necessary: macOS
Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: latest
Mobile platform/version under test: iOS IPad App .ipa
Real device or emulator/simulator: Real Device
Details

Unable to click/tap on a label or uiastatictext or button field using appium 1.6 . I was able to find element though.Tried the below code.I tried iosDriver.findElement(By.xpath("//XCUIElementTypeCell[1]")).click() but result is same. I am able to read all the elements but commands to do any actions are not working. And i see the property filedetector mobilelement is null for the returned element,.

Code To Reproduce Issue [ Good To Have ]

      tableViews = iosDriver.findElementsByClassName("XCUIElementTypeButton");
	
	
	System.out.println(iosDriver.getPageSource());
	 
	
	for (MobileElement mElement : tableViews) {
		
		if (mElement!=null  ) {
			System.out.println(mElement.getText());
			mElement.click();
			
			if( mElement.getText()==null) {
				continue;
		}
			if( !mElement.getText().contains("ScanDriverLicence")) {
				continue;
		}

        List<MobileElement>  elemetns = iosDriver.findElementsByClassName("UIAStaticText");
for (MobileElement mElement : elemetns) {
	System.out.println(mElement.getText());
	if (mElement.getText().contains("Branch108")) {
		
		String originalContext = iosDriver.getContext();
	    Point coordinate = mElement.getLocation();
	    Dimension loc = mElement.getSize();
	    int centerX = loc.getWidth() / 2 + coordinate.getX();
	    int centerY = loc.getHeight() / 2 + coordinate.getY();
	    iosDriver.context("NATIVE_APP");
	    iosDriver.tap(1, centerX, centerY, 2);
	    iosDriver.context(originalContext);
	    
	    mElement.tap(1, 1);
	    mElement.click();
	    
	    
	    JavascriptExecutor js = (JavascriptExecutor) iosDriver;
	    HashMap<String, Double> tapObject = new HashMap<String, Double>();
	    tapObject.put("x", (double) centerX);
	    tapObject.put("y", (double) centerY);
	    tapObject.put("duration", 1.0);
	    tapObject.put("touchCount", 1.0);
	    tapObject.put("tapCount", 1.0);

	    js.executeScript("mobile: tap", tapObject);
	    
	    
		//webElement.submit();
		iosDriver.tap(1, mElement, 2);
		//iosDriver.tap(2, webElement, 1);
		iosDriver.tap(1, mElement, 1);
	
		mElement.click();
		
		break;
	}

The pageSource looks like below:

         <AppiumAUT>
  <XCUIElementTypeApplication name="Customer" label="Customer" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0" x="0" y="0" width="768" height="1024">
<XCUIElementTypeWindow name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0" x="0" y="0" width="1024" height="768">
    <XCUIElementTypeOther name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0" x="0" y="0" width="1024" height="768">
        <XCUIElementTypeOther name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0/0" x="0" y="0" width="1024" height="768">
            <XCUIElementTypeOther name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0/0/0" x="120" y="134" width="784" height="500">
                <XCUIElementTypeOther name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0/0/0/0" x="537" y="134" width="367" height="500">
                    <XCUIElementTypeTable name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0/0/0/0/0" x="537" y="134" width="367" height="500">
                        <XCUIElementTypeCell name="" label="" value="" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0/0/0/0/0/0" x="537" y="134" width="367" height="98">
                            <XCUIElementTypeStaticText name="Branch108" label="Branch108" value="Branch108" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/0/0/0/0/0/0/0/0" x="552" y="142" width="344" height="21">
                            </XCUIElementTypeStaticText>
@triager triager added the Needs Triage bugs which are not yet confirmed label Nov 28, 2016
@mykola-mokhnach
Copy link
Collaborator

Duplicate of #6994

@triager please close

@triager triager closed this as completed Nov 28, 2016
@imurchie imurchie removed the Needs Triage bugs which are not yet confirmed label Apr 13, 2017
@lock
Copy link

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

4 participants