1,105,633 Community Members

How to combine two xpath conditions with 'and'

Member Avatar
bs111
Newbie Poster
2 posts since Mar 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I am just learning Xpath.

How to mix 2 or more xpath validtions into a single line.

On my page, I have 2 different tables under hthe //body tag.
I want to validate two td s that exist on these 2 different tables.

IsElementPresent is my own method. It uses Xpath.

field.IsElementPresent("//td[text()='End']");
field.IsElementPresent("//span[text()='variables']");

I tried [//td[text()='End'] and //span[text()='variables'] ].
This is failed.

Member Avatar
bs111
Newbie Poster
2 posts since Mar 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Here is the answer:

//body [table//td[text()='End'] and //table//td[text()='wel'] and //td[text()='oo'] and //span[text()='variables'] ]

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: