How to get a Selenium/Ruby bot to wait before performing an action?

前端 未结 7 771
Happy的楠姐
Happy的楠姐 2020-12-16 21:28

I\'m building a Selenium/Ruby web bot that clicks on elements. The problem is, sometimes there isn\'t enough time for the page to load before the bot decides it can\'t find

7条回答
  •  醉梦人生
    2020-12-16 22:27

    You are using wait as WebDriver function, but it isn't. Try this

    element = wait.until { driver.find_element(:class => "gb_P") }
    element.click
    

提交回复
热议问题