Note that there are some explanatory texts on larger screens.

plurals
  1. POclicking button inside a yui-overlay using webdriver not working
    text
    copied!<p>unable to click the'No' button in yui-overlay using web driver</p> <p>In my web application a yui-overlay is displayed when 'Save' button is clicked .The code for the overlay fetched using firebug(edited) is </p> <pre><code>&lt;div id="firstDiv_dialog" class="yui-module yui-overlay yui-panel" ...&gt; &lt;div class="hd" ... id="addCoveredMember_dialog_h"&gt;Title Displayed&lt;/div&gt; &lt;div id="secondDiv"&gt; &lt;div class="xyz-message-container"&gt; &lt;div class="xyz-message-info-qw"&gt; &lt;ul class="actionMessage"&gt; &lt;li&gt;&lt;span&gt;some text displayed ?&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="confirmationdialog_div" class="qw-separate-form-action-panel"&gt; &lt;div class="xyz-actionpanel"&gt; ... &lt;span class="xyz-actionpanel-item"&gt; &lt;span id="xyz-widget-button-btnConfirmNo-span"&gt;&lt;span id="btnConfirmNo" class="yui-button yui-push-button"&gt; &lt;span class="first-child"&gt;&lt;button type="button" tabindex="1002" id="btnConfirmNo-button"&gt;NO&lt;/button&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; &lt;script&gt; ... &lt;/script&gt; &lt;/span&gt; &lt;script&gt; ... &lt;/script&gt; &lt;/div&gt;&lt;/div&gt; &lt;/div&gt;&lt;a class="container-close" href="#"&gt;Close&lt;/a&gt;&lt;/div&gt; </code></pre> <p>My objective is to click the No button</p> <p>various webdriver statements i've used are</p> <ol> <li><p><code>driver.findElement(By.cssSelector("#btnConfirmNo-button")).click();</code></p></li> <li><p><code>driver.findElement(By.xpath("//span[@id=\"btnConfirmNo\"]/span/button[@id=\"btnConfirmNo-button\"]")).click();</code></p></li> <li><p><code>driver.findElement(By.xpath("//div[@class=\"xyz-actionpanel\"]/span[@class=\"xyz-actionpanel-item\"]/span[@id=\"xyz-widget-button-btnConfirmNo-span\"]/span/span/button[@id=\"btnConfirmNo-button\"]")).click();</code></p></li> <li><p><code>driver.findElement(By.id("btnConfirmNo-button")).click();</code></p></li> <li><p><code>driver.findElement(By.xpath(".//button[.='NO']")).click();</code></p></li> <li><p><code>driver.switchTo().frame(driver.findElement(By.id("addCoveredMember_dialog_c")));</code></p> <p>WebElement noAddCoveredMemberBtn_visible = (new WebDriverWait(driver, 20))</p> <p>.until(ExpectedConditions.visibilityOfElementLocated(By</p> <pre><code>.xpath("//div[@class=\"felix-actionpanel\"]/span[@class=\"felix-actionpanel- </code></pre> <p>item\"]/span[@id=\"xyz-widget-button-btnConfirmNo- span\"]/span/span/button[@id=\"btnConfirmNo-button\"]")));</p> <pre><code> driver.findElement(By.xpath(".//button[.='NO']")).click(); </code></pre></li> </ol> <p>i also tried switching to the frame(eventhough i doubt whether it is relevent in this context) as</p> <pre><code>driver.switchTo().frame(driver.findElement(By.id("firstDiv_dialog"))); </code></pre> <p>Various exceptions displayed after executing the script are</p> <ol> <li>ElementNotVisibleException:</li> <li>StaleElementReferenceException and</li> <li>timeout exception</li> </ol> <p>Observation:</p> <p>While the webdriver script run, the overlay is displayed. But the 'No' button is not getting clicked. it waits for some time and the browser closes.</p> <p>Can somebody identify, where i have made te mistake.</p> <p>Thank you</p> <p>Moshe</p>
 

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