An element can have two views of XML:
1.
<div class="GRUPP_FLG">
<div role="radiogroup">
<div class="radioButton">
<div role="radio" aria-label="Yes">
<input type="radio">
<span>Yes</span>
</div>
</div>
<div class="radioButton">
<div role="radio" aria-label="No">
<input type="radio">
<span>No</span>
</div>
</div>
</div>
</div>
2.
<div class="GRUPP_FLG">
<div>
<span title="No" class="readonlyField">
No
</span>
</div>
</div>
In the first case, I need to click on radiobutton.
WebElement radioButton = elementWithRadiogroup.findElement(By.xpath(".//*[@aria-label='No']"));
radioButton.click();
In the second case, I need check that span has a class readonlyField
if(!elementWithSpan.getAttribute("class").contains("readonlyField"))
throw new AutotestError("Error");
if use
//div[contains(@class, 'GRUPP_FLG')](//*[@role='radiogroup'] | //span[contains(@class, 'readonlyField')])
then happens error:
org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the XPath expression
because of the following error: SyntaxError: Failed to execute 'evaluate' on 'Document'
How could I get XPath?
