Note that there are some explanatory texts on larger screens.

plurals
  1. POSelenium Webdriver - (Java) - Click a button with dynamic ID
    primarykey
    data
    text
    <p>1) I have a <code>dialog</code> on my web page having 2 buttons, <code>Yes</code> &amp; <code>No</code>.<br> 2) <code>IDs</code> of these buttons are dynamicaly changing every time.<br> 3) How to handle this situation and click on <code>Yes</code> button?<br> 4) Both buttons, <code>Yes</code> &amp; <code>No</code>, have same <code>classname</code> 1.e. <code>rwInnerSpan</code><br> 5) Here is the <code>Xpath</code> for <code>Yes</code> button<br> <code>(.//*[@id='confirm1381468352443_content']/div/div[2]/a[1]/span/span)</code><br> the part <code>1381468352443</code> in xpath is <code>dynamically changing</code>.</p> <p>Below is the source code of page<br> ` </p> <pre><code>&lt;tr class="rwTitleRow"&gt; &lt;tr class="rwContentRow"&gt; &lt;td class="rwCorner rwBodyLeft"&gt; &lt;/td&gt; &lt;td class="rwWindowContent" valign="top"&gt; &lt;iframe frameborder="0" name="confirm1381468352443" src="javascript:'&lt;html&gt;&lt;/html&gt;';" style="width: 100%; height: 100%; border: 0px none; display: none;" tabindex="0"&gt; &lt;div id="confirm1381468352443_content"&gt; &lt;div class="rwDialogPopup"&gt; &lt;div class="rwDialogText"&gt; &lt;div&gt; &lt;a class="rwPopupButton" href="javascript:void(0);" onclick="$find('confirm1381468352443').close(true);" tabindex="-1"&gt; &lt;span class="rwOuterSpan"&gt; &lt;span class="rwInnerSpan"&gt;Yes&lt;/span&gt; &lt;/span&gt; &lt;/a&gt; &lt;a class="rwPopupButton" href="javascript:void(0);" onclick="$find('confirm1381468352443').close(false);" tabindex="-1"&gt; &lt;span class="rwOuterSpan"&gt; &lt;span class="rwInnerSpan"&gt;No&lt;/span&gt; &lt;/span&gt; &lt;/a&gt;` </code></pre> <p>Thanks in Advance !!</p>
    singulars
    1. This table or related slice is empty.
    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. 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