which command is used to check if a button is enabled or disabled using selenium IDE. - selenium-ide

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 :)

Related

Mailchimp mc:hideable hides the wrong section within repeatable block

I've built a custom mailchimp template and added repeatable and hideable sections so my client can edit it more easily. I have read all the documentation, my code validates, and the email itself functions great, except for one problem. Here's the gist of my layout - and ideally how I would like it to work (all extraneous code removed - but I can supply it separately if needed).
<table mc:repeatable>
<tr>
<td><img src="" alt="article image"></td>
</tr>
<tr>
<td>
<h2 mc:edit="article_title" mc:hideable>Optional Title</h2>
<div mc:edit="article_body" mc:hideable>Optional content</div>
</td>
</tr>
<tr>
<td>
<div mc:edit="article_button" mc:hideable>Optional Styled Button</div>
</td>
</tr>
</table>
When I go into the campaign editor, I can hide sections successfully. UNTIL I duplicate the block. Once I have 2 blocks, and I hide the 1st block's h2, it hides the following div. If I hide the div, it hides the button. Note: within campaign editor it appears to hide things properly. Only when I preview the email can I see that it's hiding the wrong sections.
I have tried every variation I can think of:
Nesting tables for each piece of hideable content
Separating the edit and hideaable tags to parent/child elements
Renaming all the mc:edit attributes
Moving mc:repeatable to the tr or nested tables instead
Removing mc:hideable completely, except for the button (So they would delete copy rather than hiding the whole section.)
Item 5 above resulted in a completely different problem. When I duplicated the block and hid the button on the replicated block, it hid the button in the FIRST section. It's like the names are getting crossed somehow.
There's gotta be something I'm missing. Mailchimp's documentation seems really straightforward and I haven't been able to find anything about this specific issue.
Thanks in advance!
As a workaround instead of creating mc:hideable elements inside the mc:repeatable block I've created multiple variants using mc:variant, and each variant has different items inside it.
So in your example your varients would be:
Block
Block with title
Block with content
Block with button
Block with title and content
Block with title and button
Block with title and content and button
Block with content and button
This is not quite as neat as a solution but it does work.
See here for mc:variant syntax.

How to click into row of datagirid in Selenium IDE

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

Firefox, Selenium IDE - wait for popup to load before automatically closing

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>

jQuery Selector Help Next Class

Im stuck on something and although there is 1000 different ways to select what I need, I cant get it going.
In the HTML below, the <tr class="hide"> is hidden, and when someone clicks the link in the span, I want it to slidedown.
I've tried
$(this).parent().next().slideToggle('slow');
and a bunch of other similar things, but no love. It seems because the hidden tr element is down 2 levels I cant select it.
Mind you, there will be multiple of these on a page, it needs to be the next one in line that slides down, so I cant just $('.hide') select it.
Can someone help?
Heres my HTML
<td>
<span class="details">Details</span>
</td>
</tr>
<tr class="hide">
<td></td>
Try to
$(this).closest('tr').next().slideToggle('slow');
Assuming that the code you wrote is being triggered when a user clicks the span, then your code is not going high enough up the DOM to get to the next TR. What you need is this:
$(this).parent().parent().next().slideToggle('slow');
The first parent() gets you to the <td>, and the second one gets you to the <tr>.

click / clickAndWait not working

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