The scenario is,
Click on a icon | which opens a popup;
Select a button from popup | where the selected buttons name to be loaded to a datatable;
Here, while running test suite fast, the particular popup opens, but the button is not getting selected.
But when running it in slow mode or executing textcase separately , it works fine.
i tried clickandwait, assert , etc., but i'm missing something important.
Is there any way to make it work while running it in fast mode?
This is the code,
<tr>
<td>click</td>
<td>id=btnPButton</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=FCode7</td> //This is the button id inside the popup.
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=RGrade</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=btnCC</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=btn12029</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=btn12039</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=HomeTeam</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=HJNo36</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=PlayerPosition</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=PlayerPosition45</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=btn12016</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=btn12004</td>
<td></td>
</tr>
There are a couple ways to fix this:
Do a waitForElementPresent on the button, then select it. That's usually the best way I've found to fix issues with elements not being displayed fast enough on the page.
You can set the speed during the test. Use setSpeed to set the speed fast during those sections of the test where fast works fine, if you run into a section where you need to slow it down, use setSpeed again.
Okay, here's what I would do, and have had success using this method:
click | id=btnPButton |
waitForElementPresent | id=FCode7 |
click | id=FCode7
You may want to add a pause after that to make sure it clicks before continuing the rest of the test.
Try waitforvisible (Xpath of the button) it will work
Hi i know this thread is old but I used waitForElementPresent and then put a pause and it has worked fine for me on fast
Related
I develop module-based email templates in Marketo with Marketo 2.0 syntax.
My client designed a fancy looking module where an image is overlapping 2 solid colors. If it were web design, no problem, but for email, not sure how to do this.
My only good idea is to do a table with row and column spans. Anything better out there? Do you think negative margins will work in email?
What they are asking it to look like:
My lines showing how i'd build a table to support it:
That's a good way forward (to use tables). Negative margins don't have great support.
You also cannot rely on colspan and rowspan because Outlook desktops on Windows don't support them. However, all you need to do for the section where you would use that is to nest a table.
I.e. instead of this for the middle section:
<table>
<tr>
<td bgcolor="xxx"> </td>
<td rowspan="2"> </td>
<td bgcolor="xxx"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
You would need to have one row like this:
<table>
<tr>
<td>
<table>
<tr>
<td bgcolor="xxx"> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</td>
<td> </td>
<td>
<table>
<tr>
<td bgcolor="xxx"> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
You can fake absolute positioning and then use VML for Outlook support, see Steven Sayo's awesome Overlay & Email Absolute Positioning tutorial.
I'm having an issue where the following code displays fine everywhere, but gets interpreted by mail on an iPhone as a massive vertical space. Any help would be greatly appreciated. Thanks, Andy.
<!-- 20px Spacer -->
<TABLE border=0 cellSpacing=0 cellPadding=0>
<TBODY>
<TR>
<TD height=20>
</TD>
</TR>
</TBODY>
</TABLE>
I've found the following works for cross client vertical spaces:
<td height="20" style="height:20px;">
<div style="height:20px;width:1px;"></div>
</td>
I have a popup that loads after being submitted then auto-closes, and then the parent window loads. My issue is having making sure Selenium waits until the popup has finished loading, closed and the parent window has finished loading.
On slow speed the following code works to make sure we wait until the popup loads:
<!--OK button.-->
<tr>
<td>click</td>
<td>name=_action</td>
<td></td>
</tr>
<tr>
<td>waitForFrameToLoad</td>
<td>null</td>
<td></td>
</tr>
<!--Pop up closes. Back to parent window.-->
On fast speed, the following code works because it goes to the next command so need to tell it to wait for the popup to finish loading:
<!--OK button.-->
<tr>
<td>click</td>
<td>name=_action</td>
<td></td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>id=head_check</td>
<td></td>
</tr>
<tr>
<td>waitForFrameToLoad</td>
<td>null</td>
<td></td>
</tr>
<!--Pop up closes. Back to parent window.-->
My issue is I cannot control if the user will run the script in slow or fast speed, and the slow speed results in an error if I try to waitForElementNotPresent:
[error] modifyWindow: Window was closed!
Since slow speed works, we can "slow down" fast speed at the only step it breaks by adding a pause:
<tr>
<td>pause</td>
<td>5000</td>
<td></td>
</tr>
I'll post an example and wanted to know what are the solutions for the
selenium IDE operate in "modal" windows without stop the script. I will
provide an online example and the script that I built: Detail does not
work ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base"
href="http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog2.htm" />
<title>New Test</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">New Test</td>
</tr>
</thead>
<tbody>
<!--//Open the application and wait to load the combobox-->
<tr>
<td>open</td>
<td>/workshop/samples/author/dhtml/refs/showModalDialog2.htm</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>name=oHeight</td>
<td></td>
</tr>
<!--//Insert height value and click "Push To Create" button-->
<tr>
<td>select</td>
<td>name=oHeight</td>
<td>label=250</td>
</tr>
<tr>
<td>click</td>
<td>css=input[type="button"]</td>
<td></td>
</tr>
<!--//Wait for the loading the modal page title and check the text -->
<tr>
<td>waitForElementPresent</td>
<td>//h1</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>This is a modal dialog box. This page is not designed to do
anything except display the dialog box arguments.</td>
<td></td>
</tr>
<!--//close the screen and verify that the previous screen is loaded from the height field-->
<tr>
<td>close</td>
<td></td>
<td></td>
</tr>
<tr>
<td>selectWindow</td>
<td>null</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>name=oHeight</td>
<td></td>
</tr>
</tbody>
</table>
</body>
</html>
Web applications don't actually have modal dialogs, with the exception of browser dialogs (e.g., "Save file as ...") and JavaScript's window.alert(), window.prompt(), and window.confirm(). Everything else is either a separate window (as in traditional web apps) or an overlay that blocks access to the elements behind it (as in modern, AJAXy, web apps).
In the case of a separate window, you need to waitForPopUp ...windowname... and then selectWindow ...windowname..., then selectWindow (without a name) to switch back.
In the case of an overlay, you can address it just like anything else in the page, but you may be surprised what the element locators may be (or maybe you won't be). Use Firefox's "XPather" or "Firebug" add-on to figure out the correct XPath expressions.
A recorded test script includes a google search.
After clicking on "Google Search", the next action was to click on a link in the test results, however during playback this happens before the browser has loaded the results, so the solution seemed to be to add a delay after the search. I tried it two ways :
changing "click" to "clickAndWait" with a value of 1000. This works, badly. The value of 1000 does not change the default value of 30000ms, and the playback takes 30s to complete the step.
calling "setTimeout" before the click with a value of 1000. This has no effect on the timeout behavior of clickAndWait.
Here is the script :
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>q</td>
<td>test search</td>
</tr>
<tr>
<td>setTimeout</td>
<td></td>
<td>1000</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>btnG</td>
<td>1000</td>
</tr>
<tr>
<td>click</td>
<td>link=CLEP Test Center Search</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Home</td>
<td></td>
</tr>
If anyone can advise, thanks very much.
I would recommend another solution by adding a waitForElementPresent command before clicking the link.
open /
type q test search
click btnG
waitForElementPresent link=CLEP Test Center Search
click link=CLEP Test Center Search
waitForElementPresent link=Home
click link=Home
You can find a good explanation in http://www.infoq.com/articles/testing-ajax-selenium