Finding object by using dynamic xpath, using Partial Content text
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Finding object by using dynamic xpath, using Partial Content text
Hi all,
I have following dynamic xpath's
.//*[@id='1509527131388-grid-container']/div[2]/div
.//*[@id='1509528020936-grid-container']/div[2]/div
.//*[@id='1509528970483-grid-container']/div[2]/div
.//*[@id='1509528970483-grid-container']/div[2]/div
I am trying to find the object by
var obj = Sys.Browser("*").Page("*").FindChildByXPath(".//*[@id=150952'" + * + "'-grid-container']/div[2]/div]");
showing as syntax error. Can you please help me to find the error
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FindChildByXPath(".//*[@id=150952'" + * + "'-grid-container']/div[2]/div]")
You have three single quotes in there, one on each side of + * + and one after -grid-container. Do you need to match the one after -grid-container or take it out?
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Marsha,
.//*[@id='15095 "27131388" -grid-container']/div[2]/div
.//*[@id='15095 "28020936" -grid-container']/div[2]/div
.//*[@id='15095 "28970483" -grid-container']/div[2]/div
.//*[@id='15095 "28970483"-grid-container']/div[2]/div
The one in quatations is keeping changing , I want everything else into I want find the object containing
.//*[@id='15095 "*******"-grid-container']/div[2]/div.
Please verify http://ui-grid.info/
I am trying to get the Values from the upper grid present in the page.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
See attached. I have marked the matching pairs of quotes in blue and the mismatched one in red.
You need another single quote to match the one marked in red. I believe it needs to go here
id='150952
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
XPath won't recognize "*" as a wildcard.
You should use another approach. E.g. using the contains() function:
.//div[contains(@id, "150952") and contains(@id, "grid-container")]
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
As a side note: https://community.smartbear.com/t5/TestComplete-Functional-Web/Using-Xpath-in-TestComplete/m-p/15123...
/Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to
Url: http://ui-grid.info/
Angualr UI grid
I am trying to get the values of the upper grid. I need to capture those values from the table and verify them with the values in Excel sheet in Test complete.
I used all the three types of finding the object,none of them worked. Please verify following script and let me know where I am going wrong.
Thank you for co operation in advance
function VerifyGridValue(textValue)
{
Sys.Browser("*").Page("*").Wait("10000");
var obj = Sys.Browser("*").Page("*").FindChildByXPath(".//*[@id='150952'" + * + "'-grid-container']/div[2]/div]");
//Sys.Browser("*").Page("*").FindChildByXPath("//*[@class='" + ui-grid-canvas + "']")
//var obj = Sys.Browser("*").Page("*").FindChildByXPath(".//*div[contains(@id, "150952") and contains(@id, "grid-container")]/div[2]/div]");
var val=obj.wValue(0,1);
switch (true)
{
case IsSupported(obj, val) == true && textValue :
Log.Checkpoint("Value match as expected");
break;
default:
Log.Error("Text values do not match!");
}
Log.CallStackSettings;
}
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please precise your locator more carefully:
