Following explanation of 'or' expression will help us to understand this topic briefly.
Two conditions with 'or' expression such as A or B returns the result-set shown below:
A
|
B
|
Result
|
False
|
False
|
False
|
True
|
False
|
True
|
False
|
True
|
True
|
True
|
True
|
True
|
Syntax:
//tag[@attribute='value' or @attribute='value']Example:
//div[@class='form-group' or @id='user-message']Let's get a clear view with the below example:
When Condition One and Condition Two both are False then no result is found:
//div[@class = 'spch_' or @id = 'spch_']
When Condition One is True and Condition Two is False then result is found:
//div[@class = 'spchc' or @id = 'spch_']
When Condition One is False and Condition Two is True then result is found:
//div[@class = 'spch_' or @id = 'spchc']
When Condition One and Condition Two both are True then result is found:
//div[@class = 'spchc' or @id = 'spchc']
No comments:
Post a Comment