Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

jquery - send_keys is selecting wrong options [selenium python]

I need the option 'IS' to be selected.

Options:

  1. IS
  2. OOS
  3. OOS, MT
  4. IS, AINS

Dropdown image

HTML:

<span role="listbox" tabindex="0" class="k-dropdown-wrap k-state-default" style="width: 100px;" aria-haspopup="true" aria-expanded="false" aria-owns="83b0d146-fa39-4d88-b3bd-29ead27dddb4" aria-activedescendant="option-8009bc07-0d0f-49ff-a0e5-6befb9e8e44f-0"><span class="k-input">IS</span><span class="k-select"><span class="k-icon k-i-arrow-s"></span></span><select tabindex="-1" aria-hidden="true" style="opacity: 0; width: 1px; border: 0px none; z-index: -1; position: absolute; left: 50%;"><option value="[object Object]"></option></select></span>

Python

input = cell.find_element_by_tag_name("span")
input.send_keys("IS")

I am sending "IS" as per code

But, option "IS, AINS" is getting selected instead of "IS"

Can anyone provide me a solution or alternate way using Javascript to solve this problem?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...