Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
411 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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...