Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From the <a href="https://code.google.com/p/selenium/wiki/RubyBindings" rel="nofollow">ruby bindings page</a>: (see driver examples)</p> <pre><code># wait for a specific element to show up wait = Selenium::WebDriver::Wait.new(:timeout =&gt; 10) # seconds wait.until { driver.find_element(:id =&gt; "foo") } </code></pre> <p>So ordinarily you could do something like:</p> <pre><code>wait = Selenium::WebDriver::Wait.new(:timeout =&gt; 40) wait.until do element = driver.find_element(:xpath, ".//*[@id='subTabHeaders']/div[3]") element.click end </code></pre> <p>Or more succinctly</p> <pre><code>wait = Selenium::WebDriver::Wait.new(:timeout =&gt; 40) wait.until { driver.find_element(:xpath, ".//*[@id='subTabHeaders']/div[3]").click } </code></pre> <p>However, since you say that the click doesn't raise an error, it sounds like the click is in fact working, just your page isn't really ready to display that tab. I'm guessing there's some async javascript going on here.<br> So what you can try is inside the wait block, check that the click caused the desired change. I'm guessing, but you could try something like:</p> <pre><code>wait = Selenium::WebDriver::Wait.new(:timeout =&gt; 40) wait.until do driver.find_element(:xpath, ".//*[@id='subTabHeaders']/div[3]").click driver.find_element(:xpath, ".//*[@id='subTabHeaders']/div[3][@class='selected']") end </code></pre> <p>The important thing here is that <a href="http://selenium.googlecode.com/git/docs/api/rb/Selenium/WebDriver/Wait.html#until-instance_method" rel="nofollow">#until</a> will wait and repeat until the block gets a true result or the timeout is exceeded.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload