How to select an option from a dropdown of non select tag?

后端 未结 2 1940
有刺的猬
有刺的猬 2021-01-28 00:08

I am trying to select a value from a dropdown menu. I tried a lot of solutions found here but nothing work, sometimes I have the error can\'t scroll to view.

Code trials

2条回答
  •  感动是毒
    2021-01-28 00:30

    The correct code would be

    s1=Select(driver.find_element_by_id('parentId'))
    s1.select_by_value('315')
    

    HTML attributes are very strict when it comes to extra spaces or line breaks, you need to provide value exactly as it is

    See Select Support chapter for Python WebDriver APIs designed for working with

    提交评论

提交回复
热议问题