Watir. Scroll to a certain point of the page

前端 未结 3 1516
别跟我提以往
别跟我提以往 2020-12-30 12:48

I am trying to automate an online survey on a website but I get this error each time:

Selenium::WebDriver::Error::UnknownError: unknown error: Element is not         


        
3条回答
  •  灰色年华
    2020-12-30 13:19

    Firstly, this should be unnecessary. According to the spec, all element interactions require implicit scrolling to the element. If something does prevent this from happening, though, you can use this Selenium method instead of a javascript implementation:

    buttons = browser.elements(:class => "assessment-choice")
    
    buttons.each do |button|
      button.wd.location_once_scrolled_into_view
      button.click
    end
    

提交回复
热议问题