Facing difficulies in finding xpth of one of the conext menu element in my application
Below Xpath i wrote but its still finding 6 elements.
//div[starts-with(@id,'BiComponent-')]/table/tbody/tr[2]/td[text()='Report']
Full Xpath of all 6 elemnts looks like below
/html/body/div[8]/div[1]/table/tbody/tr[2]/td[2]
/html/body/div[16]/div[1]/table/tbody/tr[2]/td[2]
/html/body/div[22]/div[1]/table/tbody/tr[2]/td[2]
/html/body/div[28]/div[1]/table/tbody/tr[2]/td[2]
/html/body/div[32]/div[1]/table/tbody/tr[2]/td[2]
/html/body/div[38]/div[1]/table/tbody/tr[2]/td[2]
Here Div tag has different value but all attributes are same for above 6 Div tag
So plese help here to find Xpath, i have attached screenshot as well
Instructor
Ashish Thakur Replied on 04/12/2019
Well you can use driver.findelements and extract all
And use the one which you want by the index
All 6 elements i am finding with help of below xPath contains the same text as Report, so how to find the one which i am lokking in to it?
//div[starts-with(@id,'BiComponent-')]/table/tbody/tr[2]/td[text()='Report']
Instructor
Ashish Thakur Replied on 11/12/2019
You want the first one or Second one or which one?
I want the element which exist in last one
Instructor
Ashish Thakur Replied on 22/12/2019
List<WebElement> all = driver.findElements(By.xpath("/html/body/div[8]/div[1]/table/tbody/tr[2]/td[2]"));
WebElement sixthElement = all.get(all.size()-1)