Hi All,
I have to get the list of text value from the LinearLayout each as you can seen in the attached screen shot … i tried with following code but couldn’t get the result
//@FindBy(how =How.XPATH, using = “//android.widget.TextView[contains(@resource-id, ‘com.jutera.perkprizemob.aphone:id/tv_notificationText’)]”)
WebElement ListOfBid_SpentActivity_Text;
public void ListOfBidActivity()
{
List ListofActivity = ListOfBid_SpentActivity_Text.findElements(By.tagName(“text”));
for(int i = 0; i>=ListofActivity.size();i++)
{
System.out.println(ListofActivity.get(i).getText());
}
}
appreciate if any one of you could help me out here…
Thanks
Print ListofActivity.size() and check it is printing something or not?
Hi Yadsandy…
Thanks for your replay… i modified the xpath and tried as follows , so it just print 1 but not the text.
@FindBy(how =How.XPATH, using = “//android.widget.LinearLayout[contains(@resource-id, ‘com.jutera.perkprizemob.aphone:id/lnr_currencyNotificationLayout’)]”)
WebElement ListOfBid_SpentActivity_Text;
List ListofActivity = ListOfBid_SpentActivity_Text.findElements
(By.id(“com.jutera.perkprizemob.aphone:id/tv_notificationText”));
System.out.println(ListofActivity.size()
Can you please have a look and let me know what is the issue… i tried different ways, but didn’t get the text value
Thanks
may be you need this:
WebElement ele=driver.findElement(By.id(“com.jutera.perkprizemob.aphone:id/mainContentLayout”));
java.util.List list=ele.findElements(By.id(“com.jutera.perkprizemob.aphone:id/lnr_currencyNotificationLayout”));
for(WebElement value:list){
System.out.println(value.findElement(By.id(“com.jutera.perkprizemob.aphone:id/tv_notificationText”)).getText());
}
Thanks yadsandy… Now the text got printed.
And one more issue which iam facing on getting attribute value of an element as you can see in the attached screenshot, i tried with the following code, but it didn’t print the text,
@FindBy(how = How.XPATH, using="//android.view.View[@index=‘1’]" )
WebElement proPosed_bid_token_value;
String Token_value = proPosed_bid_token_value.findElement
(By.xpath("//*[@attribute = ‘content-desc’]")).getText();
use it like this //*[@content-desc=‘text’]
Hi Sandeep Yadav,
Thanks for your replay. I tried many ways as you suggested but didn’t get the text printed
WebElement Token_value = proPosed_bid_token_value.findElement
(By.xpath("//*[@content-desc=‘text’]"));
System.out.println(Token_value.toString());
can you please let me the issue?
Thanks
its a web view bro so you have to first change the content to webview and then inspect usibg selendroid inspector and preform remaining actions.
please provide the apppackage and app activity
Hi Sandeep,
The app one which iam testing is web view enabled …
Iam sharing apppackage and activity details below
appPackage", “com.jutera.perkprizemob.aphone”
appActivity", "com.jutera.perkprizemob.SplashActivity’
Thanks