0

I am trying to use python selenium to select an element from a drop-down-bar, and also select the start_date and end_date. Please find the url:

<select title="drop_down" name="sType1" class="single_select2" style="display: none;" id="single_select_2">
<option value="">choice</option>
","
<option value="2101">issuance</option>
","
<option value="2701">listing</option>
","
</select>

and I use code:

driver.get('http://www.sse.com.cn/disclosure/bond/announcement/npcorporate/')
driver.implicitly_wait(20)
s1 = Select(driver.find_element_by_id('single_select_2'))
driver.implicitly_wait(20)
s1.select_by_value('2101')
driver.find_element_by_id('btnQuery').click()

but the website says:

ElementNotInteractableException: element not interactable: Element is not currently visible and may not be manipulated' how could I make it visible and able to select it?

and I dont know how to put my code to select dates. Could it be possible?

Any help will be appreciated!

Joyce
  • 435
  • 4
  • 13

2 Answers2

0

The HTML of the <select> element with you have shared contains the attribute style="display: none;". Presumably,

  • This is not your desired element, or
  • The element will become visible only after certain actions being taken before trying to interact with it.

Else Selenium won't be able to focus on the <select> element to interact with it.


References

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thank you for your help! I can see what the problem is, but still do not know the solution.. – Joyce Jan 24 '21 at 02:19
0
  • Use find_element(By.XPATH, drag_and_drop_xpath)
  • Check css style's visibility
  • If none or not visibility, add visibility: visible;
  • Then you can see visible drop and down
ryan
  • 1
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 03 '22 at 07:54