Santhosh
Santhosh

Reputation: 579

Need help in writing XPATH for Selenium with Python

Below is the element in DOM.

<div style="float:left;width: 40px">
<label class="radio inline">
<input id="formData99991:Select" class="sample" data-ng-model="sampletId" size="" name="formData99991Select" sample-value="true" style="" value="1234" checked="checked" type="radio"/>
A
</label>
</div>

I tried with //input[contains(@id,'formData99991:Select') and contains(text(),'A')] but it doesn't work. There are multiple similar elements on the web page and I need to identify each element with combo of id and text.

Upvotes: 1

Views: 42

Answers (1)

Murthi
Murthi

Reputation: 5347

You can try with following x-path,

//label[contains(.,'A')]/input[@id="formData99991:Select"]

Upvotes: 2

Related Questions