How to switch and access an element on modal dialogue window using Ruby Page Object?

73 views
Skip to first unread message

rubban...@gmail.com

unread,
Mar 22, 2015, 3:24:36 PM3/22/15
to page-...@googlegroups.com
Dear Group,

I need help regarding following issue:

I have homePage.rb (using Ruby page object. Selenium-webdriver gem) file that navigate to the website, click the Login link that open a modal dialogue window. Now I want to click a link 'Register' on this modal dialogue window. But it giving an error message that 'NoSuchElement'.

In the page source, this modal dialogue window is not a frame, not a window, not an alert but form. this form is available inside nested div. See following code and attached image:

<body class="noTouch layerOpen" itemtype="http://schema.org/WebPage" itemscope="">
<div id="MSXLayer" style="display: block; height: 250px; margin-left: -252.5px; margin-top: -125px; top: 50%; width: 505px;">
<div class="layerLoad" style="display: none;"></div>
<a class="closeLayer" href="closeLayer" style="display: inline;">×</a>
<div class="content">
<div id="MSXLayerContent" style="display: block;">
<div id="LoginForm" class="floatLeft">
<div class="grid grid6">
<h3>Log in</h3>
<p>If you are already a Mister Spex customer, your contact details will be automatically filled in. </p>
</div>
<form id="login-user-form" class="grid grid6" action="https://www.misterspex.co.uk/INTERSHOP/web/WFS/MisterSpex-MisterSpexGB-Site/en_GB/-/GBP/ViewUserAccount-ProcessLogin" name="LoginUserForm" method="post">
<input type="hidden" value="03c51fa2d21e7ff3b37923cfbe0533ea7611102aec8ab462b543a4bcdbf9158c" name="SynchronizerToken">
<div class="floatLeft grid grid6">
<div class="floatLeft grid grid6">
<div class="grid grid5">
<button class="green grid grid3 gridRight txtCenter" name="login" value="login" data-icon="" type="submit">Login</button>
<br>
New Customer?
<a data-height="400" data-width="505" data-layer="login" href="https://www.misterspex.co.uk/register#RegisterFormLayer">Register</a>
</div>
</form>
</div>
</div>
</div>
</div>

All help appreciated
Regards,


Screen Shot 2015-03-22 at 20.22.59.png

Andrew Leaf

unread,
Mar 23, 2015, 2:19:17 PM3/23/15
to page-...@googlegroups.com
Can you provide the ruby code you're using to access the page?

It looks like you should be able to access the link using something like:


--
Leaf

Steve Gibson

unread,
Mar 23, 2015, 2:22:52 PM3/23/15
to page-...@googlegroups.com
Treat the login, password, and button elements as if they were on the home page.  Or, create a login module with those elements and include the module in all the page classes that can pop open the modal.

Modals don't need to be switched into/out of like iframe/frames - they're just part of the page.  However, if your modal loads elements inside an iframe, you'll need to switch in/out.
Reply all
Reply to author
Forward
0 new messages