A
A
Aleksandr2019-05-14 14:43:12
Python
Aleksandr, 2019-05-14 14:43:12

How to find the value?

Greetings to all)
I am looking for elements by xpath, but with one there was difficulty. Here is an example of a working search:

browser.find_element_by_xpath("//td[text()='Изменено']/following-sibling::td[1]").click()
- it works, everything is OK.
Here is a piece from which you need to find and click on "yellow"
<td>
<select name="LAMP[]" size="4" multiple="multiple">
  <option value="">(нет)</option>
  <option value="red">красный</option>
  <option value="yellow">желтый</option>
  <option value="green">зеленый</option>
  <option value="grey">серый</option> </select></td>

When copying the xpath from the console, I get this: //*[@id="flt_row_ticket_grid_LAMP"]/td[2]/select/option[3]
Tried this:
browser.find_element_by_xpath("//select['option' and @value='yellow']/following-sibling::td[2]").click()

but doesn't work.
Thanks everyone

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Fov, 2019-05-14
@QQQ-RRR

I'm not familiar with selenium, but try this

//select[@name = 'LAMP[]']/option[@value = 'yellow']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question