Selenium-Webdriver Ruby --> How to wait for images to be fully loaded after click

后端 未结 4 1675
星月不相逢
星月不相逢 2020-12-11 23:33

I am very new to Ruby and Selenium-Webdriver, so please, help :)

I am trying to open email campaign , sent to my inbox, that has images and take a screenshot in the

4条回答
  •  一个人的身影
    2020-12-12 00:14

    ExpectedConditions isn't supported yet in the Ruby Selenium bindings. This snippet below does the same thing as ExpectedConditions.elementToBeClickable — clickable just means "visible" and "enabled".

    element = wait_for_clickable_element(:xpath => xpath)
    
    def wait_for_clickable_element(locator)
      wait = Selenium::WebDriver::Wait.new(:timeout => 10)
    
      element = wait.until { @driver.find_element(locator) }
      wait.until { element.displayed? }
      wait.until { element.enabled? }
    
      return element
    end
    

提交回复
热议问题