0

I have web page and from where i am trying to select the XPATH from a drop down box which dont have any value.

<select name="selectOption" id="selectOption">
<option value="">Please select</option>
<option value="Op1">Op1</option>
<option selected="selected" value="Op2">Op2</option>
<option value="Op3">Op3</option>
</select>

I am trying to select the "Please Select" option as below by XPATH,

//*[@id="selectOption"]/option[1] 

but i am not geeting the Please Select.Here Please select has value as blank.

And Suggestion approach must be appreciated.Thanks

Zia
  • 1,001
  • 1
  • 13
  • 25
  • Are you getting any errors? What are you getting then if not "Please select" ? Try to select by text. – lauda Jan 20 '17 at 11:38
  • i am not getting any error.Its just not selecting that value.and i want to select that to run my test script.Text will take the values right?i tried but noluck – Zia Jan 20 '17 at 11:39
  • You selector is ok, you can also try it in the browser and see if it returns only one element, if yes then you might have some code issue, also please add the code used for select if possible. – lauda Jan 20 '17 at 11:44
  • I am have serenity jar and test script in excel sheet,i am using above code block to select that value but its not selecting during the run of test script – Zia Jan 20 '17 at 12:46

1 Answers1

0

Try using Select.selectByVisibleText()

John Smart
  • 969
  • 1
  • 5
  • 5