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
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.
You can not click a button unless you edit at least one field, and button will be disabled. once you edit any field the button 'reset' will be enabled to click.
You can solve this in a number of ways.
Probably one of the more useful ways (If you are using this fact more than once), is to save the "status" of the button to a variable.
Below are two separate examples of how you could code this.
The first example will take a variable called isSelected, and assign it either a value of "block" or "none" dependent on how the selector is displaying.
The second example will look at the radio button and see whether it is present in the "On" state or not.
This first one uses the jQuery addon
<tr>
<td>storeEval</td>
<td>jQuery('div.search-date-container div.modal').css('display')</td>
<td>isSelected</td>
</tr>
<tr>
<td>gotoIf</td>
<td>storedVars['isSelected']=='block'</td>
<td>skipToDatepicker</td>
</tr>
This second one doesn't
<tr>
<td>storeElementPresent</td>
<td>id=edw_paynow</td>
<td>edwPresent</td>
</tr>
<tr>
<td>echo</td>
<td>${edwPresent}</td>
<td></td>
</tr>
<tr>
<td>gotoIf</td>
<td>${edwPresent}==false</td>
<td>skipEDW</td>
</tr>
You may need to adapt the code slightly - but I don't know what buttons you are using. If you provide a bit more info and an upvote I'm sure I could try figure it out :)
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
I have a web page and a gird on it.
I want to click on a cell of my grid in Selenium IDE.
but this code doesn't work.
selenium.click("//tr[#id='row8']/td[2]");
Thank you so much
Try This.
<tr>
<td>clickAndWait</td>
<td>id=cellid </td>
<td></td>
</tr>
in the target locator field give either id ,name,css or xpath
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>