Note that there are some explanatory texts on larger screens.

plurals
  1. POIn Watir, how can I interact with an element that is initially "hidden?"
    primarykey
    data
    text
    <p>I'm trying to test a page containing an element that, when the page is first opened, has its style= attribute set to <code>display: none;</code>. In Firefox, when the test interacts with the page (two text fields, for now), the button is enabled, and can be clicked programmatically. In IE8, however, the button cannot be clicked if the page has been interacted with by the test, even if I try to manually click it. This is what the code looks like:</p> <pre><code>&lt;a tabindex="21" onclick="if(!allow_submit() || nextStepLocked()){return false;};; new Ajax.Request(saveInfo); return false;" id="nextStepButton" href="#" class="nextButton" style="display: none;"&gt; &lt;img src="/btn_next_step.png" alt="Btn_next_step"&gt; &lt;/a&gt; &lt;img style="" src="/btn_next_step.png?" id="hiddenNextStepButton" class="nextButton" alt="Btn_next_step"&gt; </code></pre> <p>There's a similar block on the page that leads to this one, and I was able to click it just fine with the code <code>browser.image(:alt =&gt; "Btn_next_step").click</code>. I also noticed that when the image switches from a non-clickable to a clickable state, it moves up a few pixels; if I trigger the clickable state in code, this same movement occurs, but the button does not become clickable.</p> <p>So far, I have tried using AutoIt to mimic the actions normally taken on the page, and I have also tried many different ways of interacting with the image, such as referencing different indices, using multiple identification methods at once, and so on. I even tried messing around in irb, but to no avail. </p> <p>Update:</p> <p>I checked the input fields, and they do indeed respond to onchange events, but only to capitalize the first letter of the text you enter. Since the button seems to work if I do just about anything on the page, I looked through the entire source and found the following at the end of the page: </p> <pre><code>&lt;script&gt; document.onkeydown=function(e){ accession_hotkeys(e); }; &lt;/script&gt; </code></pre> <p>I'm not sure how to properly fire this event, though. Doing it on any specific element doesn't seem to have an effect.</p>
    singulars
    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.
 

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