Unable to get the element from the pop up

Hi All,

Iam facing issue in getting value from the Framelayout pou up in android…
attaching the screen shot here…
appreciate for the help
Thanks

System generated pop up wont catch by uiautomator

Hi Jitu… Thanks for the respond… this pop up actually is related with the application that would show while taping on a above account option… let me know is there any way to handle to get the text from them

Thanks

In selenium there is one switchto function try to use that.

Hi Vibi… i tried using switch method to handle the framelayout but its not working as expected in the device

What errors are you getting? The fields do not have unique classes or resource ids, so you’ll likely need to use either find_elements via class/resource-id/xpath, and then cycle through the resulting elements

Hi WIll Osser,
Thanks for your replay… its working as expected… now i have other scenario similar to this with list of block in the popup which iam not able to find it thorough different way as you suggested…
can you please look in to the attached screen shot
i would be need to get the count of each block and the text from each…

Would be great if you can help me out here

Thanks

@hariumesh, what xpath are you using to find the elements?

Hey Willosser…thanks for your replay … now the problem got resolved… i have another issue where iam getting null pointer exception while calling the method thoruh another test cases in current tc…
for eg:
there are method defnined for accessing common method from the same as

public void waitFortheElement(WebElement elm)
{
	 WebDriverWait wait = new WebDriverWait(this.driver, 3000);
	 wait.until(ExpectedConditions.elementToBeClickable(elm));	
}

public void transferDirectSelection()
{
waitFortheElement(transfer_Direct);;
opr.SelectElementIfitsDisplayed(transfer_Direct);
}
and the above is actually reflected through the respective page factory in the TC says “Transfer Direct Test cases” in class 1

i am using the same tc in another class says tc2 by creating an object . but iam getting Null Pointer exception on above specified method… can you tell me where is the exact issue?

Thanks

Is the exception being raised in waitFortheElement() or in the call to opr.SelectElementIfitsDisplayed()?

Hi WIlloser…
The exception raised on waitFortheElement() method defined in the class…so can’t we inherit the method from a test case defined with @Test annotation in another Test class?

That’s between you and your java interpreter/compiler

Hi Willosser,
I got the issue now… Thanks for your replay… and another issue iam facing which i already have raised in the discussion list . Iam not able to keep swiping in the spinner list in order to select the element which located at last in the list…iam using swipeUP method which swipe with first specified element as seen in the below code…
public boolean swipeUP() throws InterruptedException
{

	MobileElement elm = (MobileElement)driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@resource-id,'android:id/text1') and @index = '8']"));
	elm.swipe(SwipeElementDirection.UP, 6000);
	Thread.sleep(1000);
	MobileElement elm1 = (MobileElement)driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@resource-id,'android:id/text1') and @index = '9']"));
	elm1.swipe(SwipeElementDirection.UP,7000);
	Thread.sleep(1000);
	MobileElement elm2 = (MobileElement)driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@resource-id,'android:id/text1') and @index = '8']"));
	elm2.swipe(SwipeElementDirection.UP,8000);
	MobileElement elm3 = (MobileElement)driver.findElement(By.xpath("//android.widget.CheckedTextView[contains(@resource-id,'android:id/text1') and @index = '7']"));
	elm3.swipe(SwipeElementDirection.UP,10000);
	return true;
	}

but its not swiping from second element defined with in same method above… not sure how i wrong here if it is… would be great if you suggest a solution to fix the same…
Thank you

I notice that you are using indexes, 8, 9, 8, and 7. Are you certain those elements exist? I’d call findElements with only the first parameter in your By.xpath and check the index values of those elements. After you swipe up the first, time, what elements are still visible?

Hi Willosser… Thanks for your replay…yes now its working … and one more issues… iam not getting the text of element from the page as you can seen here

i have taken the xpath of element as

@FindBy(how = How.XPATH, using ="//android.widget.TextView[contains(@resource-id,‘com.wallet.client:id/txn_receipt_row_value_tv’) and @index= ‘4’]")
private WebElement customerNumFromSuccess ;

i also tried with bounds value … but didn’t work …
But iam able to access the ‘Sucess’ element with the bounds value and index

please look in to the attached screen shot below.

Would be great if you can find the issue exactly here…
Thanks

Hi @hariumesh,

Does the find by xpath work? That is, are you returned an element that is lacking a text value, or is there no element returned?

Hi Willosser…
Iam expecting to return the text value with that element… but it’s not returning any value…and getting No such element exception…

That suggests the element is not being found, and that something is wrong with your xpath.

Hey Willosser… now the issue got fixed… Thanks… Now the another issues on a pop up which iam not able to handle with normal case.
i tried with clicking on ‘Ok’ button as you can seen in the attached pic with different xpath available in the UIAutomatorviewer as
@FindBy(how = How.XPATH, using ="//android.widget.Button[@bounds=’[768,1088][1032,1232]’ and @text=‘Ok’)]")
private WebElement pinOk ;
and even with the android event key method as 'driver.pressKeyCode(66)) but both didn’t work at all …
can you tell me please how to handle those kind of pop up …
Thanks