Selenium IDE requires 2 identical commands for button press - selenium

Here is an exerpt from my Selenium script
<tr>
<td>storeElementPresent</td>
<td>css=a.btn.btn-style-c[href="/shortlist/Remove/${codeparc}"]</td>
<td>isSelected</td>
</tr>
<tr>
<td>echo</td>
<td>${isSelected}</td>
<td></td>
</tr>
<tr>
<td>gotoIf</td>
<td>${isSelected}==true</td>
<td>skipToRemoveFromShortlist</td>
</tr>
<tr>
<td>click</td>
<td>css=a.btn.btn-style-c[href="/shortlist/Add/${codeparc}"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>css=a.btn.btn-style-c[href="/shortlist/Add/${codeparc}"]</td>
<td></td>
</tr>
<tr>
<td>gotoLabel</td>
<td>endOfShortlisting</td>
<td></td>
</tr>
<tr>
<td>label</td>
<td>skipToRemoveFromShortlist</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>css=a.btn.btn-style-c[href="/shortlist/Remove/${codeparc}"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>css=a.btn.btn-style-c[href="/shortlist/Remove/${codeparc}"]</td>
<td></td>
</tr>
<tr>
<td>label</td>
<td>endOfShortlisting</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=cboxClose</td>
<td></td>
</tr>
Commands 4 and 5 are duplicates
Commands 8 and 9 are duplicates
In step through mode if I execute the command twice it works fine.
Test page for you to look at - www.eurocamp.co.uk/pa012

Related

Selenium goBack and wait

I have this selenium test (a part of it).
<tbody>
<tr>
<td>open</td>
<td></td>
<td>localhost:8091</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Rest objects</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>xpath=(//a[contains(text(),'Show')])[3]</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>xpath=(//div[not(div)][1])</td>
<td>ID: 2</td>
</tr>
<tr>
<td>goBack</td>
<td></td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>xpath=(//a[contains(text(),'Show')])[5]</td>
<td></td>
</tr>
<tr>
<td>goBack</td>
<td></td>
<td></td>
</tr>
</tbody>.
I use Selenium IDE in Firefox. When I run it slowly (toggle speed), it works well. However, when I try to run it faster, I get error at the step <td>clickAndWait</td> after <td>goBack</td>. The log says,
Element xpath=(//a[contains(text(),'Show')])[5] not found.
My questions, how to go back and wait until the page is loaded before I perform other actions.
You have to use waitForPageToLoad command adter click on element till the page loaded and then perform other actions
Use Below code
<tr>
<td>click</td>
<td>xpath=(//a[contains(text(),'Show')])[5]</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td>10000</td>
<td></td>
</tr>
Thanks (#Trimantra Software Solution).
waitForPageToLoad this is what I needed.
From documentation:
waitForPageToLoad(timeout)
Arguments:
timeout - a timeout in milliseconds, after which this command will return with an error
Waits for a new page to load.
This is my solution, I used waitForPageToLoad after goBack.
<tbody>
<tr>
<td>open</td>
<td></td>
<td>localhost:8091</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Rest objects</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>xpath=(//a[contains(text(),'Show')])[3]</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>xpath=(//div[not(div)][1])</td>
<td>ID: 2</td>
</tr>
<tr>
<td>goBack</td>
<td></td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad</td>
<td>800</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>xpath=(//a[contains(text(),'Show')])[5]</td>
<td></td>
</tr>
<tr>
<td>goBack</td>
<td></td>
<td></td>
</tr>
</tbody>
I see a goBackAndWait() variant of this command. That might work for you.
Typically I'd advise using a waitFor to ensure the page is back to where you want. Simplest that may work is waitForTitle if possible.
waitForElementPresent & waitForText also good ones to look at.

Error during using Selblocks in Selenium IDE

I have a problem with Selblocks extension to Selenium IDE. I've prepare XML file:
<testdata>
<vars projekt="1-2OM0W5"/>
<vars projekt="1-2P3K19"/>
<vars projekt="1-2P2O6L"/>
<vars projekt="1-2P00UN"/>
<vars projekt="1-2OW20F"/>
</testdata>
Selenium is taking first value from XML correctly. Unfortunately after endForXml command I have such error:
[error] Unexpected Exception: TypeError: activeBlockStack(...).top(...) is undefined.
`<tr>
<td>loadTestData</td>
<td>file://C://Users//mkulesza//Desktop//14.4 RELEASE/new 10.xml</td>
<td></td>
</tr>
<tr>
<td>while</td>
<td>!testdata.EOF()</td>
<td></td>
</tr>
<tr>
<td>nextTestData</td>
<td></td>
<td></td>
</tr>
<tr>
<td>store</td>
<td></td>
<td>klient</td>
</tr>
<tr>
<td>store</td>
<td></td>
<td>wycena_clnet</td>
</tr>
<tr>
<td>store</td>
<td></td>
<td>numer</td>
</tr>
<tr>
<td>open</td>
<td>http://clnet-prp/Main.aspx</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=FindMenu1_btnCosting</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>id=AssignedTo_chosen</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>xpath=/html/body/table[2]/tbody/tr/td/div/form/fieldset/div[2]/table[2]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]/div/div/div/ul/li[contains(.,"wszy")]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=QuotaId</td>
<td>${projekt}</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=btnForm</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>2000</td>
<td></td>
</tr>
<tr>
<td>storeText</td>
<td>xpath=html/body/table[2]/tbody/tr/td/div/fieldset/div/div/div/div/table/tbody/tr/td[1]</td>
<td>numer</td>
</tr>
<tr>
<td>echo</td>
<td>${numer}</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=${projekt}</td>
<td>link=${projekt}</td>
</tr>
<tr>
<td>clickAt</td>
<td>id=assignedTo_chosen</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>xpath=/html/body/table[2]/tbody/tr/td/div/form[1]/fieldset/div/div[2]/div[3]/div/div[2]/div/div/div/ul/li[contains(.,"CLNET_TEST_PM")]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=btnChangeAssigment</td>
<td></td>
</tr>
<tr>
<td>refreshAndWait</td>
<td></td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>id=ActionPerformed</td>
<td>Zaakceptuj do wyceny (Accepted)</td>
</tr>
<tr>
<td>type</td>
<td>id=comment</td>
<td>Test Comment</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=btnPerformAction</td>
<td></td>
</tr>
<tr>
<td>storeText</td>
<td>xpath=/html/body/table[2]/tbody/tr/td/div/fieldset[2]/div/table/tbody/tr/td[1]/div/div[2]/span</td>
<td>klient</td>
</tr>
<tr>
<td>echo</td>
<td>${klient}</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${wycena_clnet}</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>https://solver/test/DataDigger/Public/index.php</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//ul[#id='menu-content-5']/li/p</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>6000</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>xpath=/html/body/div[5]/div/div[2]/button[1]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=QuoteIdShow</td>
<td>${numer}</td>
</tr>
<tr>
<td>sendKeys</td>
<td>name=QuoteIdShow</td>
<td>${KEY_DOWN}</td>
</tr>
<tr>
<td>pause</td>
<td>2000</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[contains(text(), '${numer} ${klient}')]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=realSelection</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>xpath=/html/body/div[5]/div[2]/div[2]/div[3]/button[1]</td>
<td></td>
</tr>
<tr>
<td>assertConfirmation</td>
<td>Jesteś pewien, że chcesz dodać?</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>5000</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>xpath=/html/body/div[5]/div[2]/div[2]/div[2]/div/div[1]/div[1]/div/div[2]/div/div/div/table/tfoot/tr/th[1]/div/button[2]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>xpath=/html/body/div[5]/div[2]/div[2]/div[2]/div/div[1]/div[1]/div/div[2]/div/div/div/table/tbody/tr[2]/td[2]/div/div[1]/dd/input</td>
<td>DATERA</td>
</tr>
<tr>
<td>sendKeys</td>
<td>xpath=/html/body/div[5]/div[2]/div[2]/div[2]/div/div[1]/div[1]/div/div[2]/div/div/div/table/tbody/tr[2]/td[2]/div/div[1]/dd/input</td>
<td>${KEY_DOWN}</td>
</tr>
<tr>
<td>pause</td>
<td>3000</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>xpath=/html/body/div[5]/div[2]/ul[9]/li[3]/a[contains(text(), 'DATERA Call-eX brama GSM x 4')]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>xpath=/html/body/div[5]/div[2]/div[2]/div[2]/div/div[1]/div[1]/div/div[2]/div/div/div/table/tbody/tr[2]/td[3]/div/div[1]/dd/textarea[2]</td>
<td>TEST</td>
</tr>
<tr>
<td>click</td>
<td>css=.SaveUpdateButton</td>
<td></td>
</tr>
<tr>
<td>assertConfirmation</td>
<td>Jesteś pewien, że chcesz zapisać zmiany?</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>3000</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>http://clnet-prp/Main.aspx</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>id=FindMenu1_btnCosting</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=FindMenu1_btnCosting</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>id=AssignedTo_chosen</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>xpath=/html/body/table[2]/tbody/tr/td/div/form/fieldset/div[2]/table[2]/tbody/tr/td[1]/table/tbody/tr[1]/td[2]/div/div/div/ul/li[contains(.,"wszy")]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=QuotaId</td>
<td>${projekt}</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=btnForm</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=${projekt}</td>
<td>link=${projekt}</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>id=costingSystemId</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=costingSystemId</td>
<td>${numer}v1</td>
</tr>
<tr>
<td>click</td>
<td>id=btnChangeAssigment</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>id=ActionPerformed</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>id=ActionPerformed</td>
<td>Wyślij wycenę (Completed)</td>
</tr>
<tr>
<td>type</td>
<td>id=comment</td>
<td>Zamknieto w CLNET</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=btnPerformAction</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>xpath=/html/body/table[2]/tbody/tr/td/div/form/fieldset/div[2]/button[1]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>xpath=/html/body/table[2]/tbody/tr/td/div/form/fieldset/div[2]/button[1]</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
</tbody></table>
</body>
</html>`
No idea what is wrong.
Thanks for help

How can i verify text present in Selenium IDE?

I have a form to check code Order in which I put "phone number" to search.
In a result list, I use verifyTextPresent to verify the value, but it fails.
Here is my link https://ventomarme55.bizwebvietnam.net/apps/kiem-tra-don-hang
and here my code:
<tr>
<td>open</td>
<td>https://ventomarme55.bizwebvietnam.net/apps/kiem-tra-don-hang</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>name=CheckType</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=PhoneNumber</td>
<td>0987610597</td>
</tr>
<tr>
<td>click</td>
<td>//button[#class='btn pull-right']</td>
<td></td>
</tr>
<tr>
<td>verifyTextPresent</td>
<td>Số điện thoại: 0987610597</td>
<td></td>
</tr>
Use Value for input
<tr>
<td>open</td>
<td>/apps/kiem-tra-don-hang</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>id=PhoneNumber</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=PhoneNumber</td>
<td>4141414</td>
</tr>
<tr>
<td>waitForValue</td>
<td>id=PhoneNumber</td>
<td>4141414</td>
</tr>
<tr>
<td>verifyValue</td>
<td>id=PhoneNumber</td>
<td>4141414</td>
</tr>

How to manipulate the 'value' in selenium IDE?

The Scenario is,
I recorded the task, which is,
Login, edit a field and save it with different name(but the original field remains),logout.
Here i need to manipulate the 'name' field, so i can get 100 or more copies of it, with unique names.
Is it possible in Selenium IDE?, if not , is there any open source tool available to do the same?
</thead><tbody>
<tr>
<td>open</td>
<td>/SurveyHome.aspx</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=ctl00_ContentPlaceHolder1_gvSurvey_ctl02</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=ctl00_ContentPlaceHolder1_txtsurname</td>
<td>Survey 1</td> // This is the name of the survey.
</tr>
<tr>
<td>clickAndWait</td>
<td>id=ctl00_ContentPlaceHolder1_btncopysurok</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>id=ctl00_ContentPlaceHolder1_btncopyok</td>
<td></td>
</tr>
</tbody></table>
How to use the while loop in this code, i tried using but, the selenium ide is not recognising it.Can you plz help me with this..
You can use while loop for your purpose
<tr>
<td>getEval</td>
<td>index = 1;</td>
<td></td>
</tr>
<tr>
<td>while</td>
<td>index < 10;</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>index</td>
<td>value</td>
</tr>
<tr>
<td>echo</td>
<td>survey ${value}</td>
<td></td>
</tr>
<tr>
<td>getEval</td>
<td>index++;</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
in the name text box field you give the value has survey ${value},
now you can create any number of form with unique name by
using this while loop put your form inside this while loop.
Try it
Thank you.
<tr>
<td>open</td>
<td>/SurveyHome.aspx</td>
<td></td>
</tr>
<tr>
<td>getEval</td>
<td>index = 1;</td>
<td></td>
</tr>
<tr>
<td>while</td>
<td>index < 100;</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>index</td>
<td>value</td>
</tr>
<tr>
<td>echo</td>
<td>survey ${value}</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>id=ctl00_ContentPlaceHolder1_gvSurvey_ctl02</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=ctl00_ContentPlaceHolder1_txtsurname</td>
<td>survey ${value}</td>
</tr>
<tr>
<td>click</td>
<td>id=ctl00_ContentPlaceHolder1_btncopyok</td>
<td></td>
</tr>
<tr>
<td>getEval</td>
<td>index++;</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
try it.
thank you

Cannot execute a Selenium IDE test case for a Pop Window

Hi can any one please help me with this script please.
I cannot run a test case for pop window with selenium IDE.
here is the following script i am using to run the test case.
<tr>
<td>open</td>
<td>/car-insurance</td>
<td></td>
</tr>
<tr>
<td>assertTitle</td>
<td>Car Insurance | Netpig Insurance</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>//img[#alt='Get an insurance quote']</td>
<td></td>
</tr>
<tr>
<td>selectPopUpAndWait</td>
<td>GetaCarInsurancequote</td>
<td>30000</td>
</tr>
<tr>
<td>selectWindow</td>
<td>null</td>
<td></td>
</tr>
<tr>
<td>assertTitle</td>
<td>Car Insurance | Netpig Insurance</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>form1:txt_4_3_0_Policy_CoverDate</td>
<td>26</td>
</tr>
<tr>
<td>type</td>
<td>form1:txt_4_4_0_Policy_CoverDate</td>
<td>05</td>
</tr>
<tr>
<td>type</td>
<td>form1:txtRegLookup</td>
<td>VN05XVO</td>
</tr>
<tr>
<td>click</td>
<td>form1:imgGetVehicle</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>form1:cboVehicleYearOfManufacture</td>
<td>label=2006</td>
</tr>
<tr>
<td>select</td>
<td>form1:cboVehicleModified</td>
<td>label=Select</td>
</tr>
<tr>
<td>select</td>
<td>form1:cboVehicleModified</td>
<td>label=No</td>
</tr>
<tr>
<td>type</td>
<td>form1:txtPurchaseDateDay</td>
<td>10</td>
</tr>
<tr>
<td>type</td>
<td>form1:txtPurchaseDateMonth</td>
<td>02</td>
</tr>
<tr>
<td>type</td>
<td>form1:txtPurchaseDateYear</td>
<td>2009</td>
</tr>
<tr>
<td>type</td>
<td>form1:txtVehicleEstimatedValue</td>
<td>2001</td>
</tr>
<tr>
<td>select</td>
<td>form1:cboVehicleNightLocation</td>
<td>label=Car Park</td>
</tr>
<tr>
<td>type</td>
<td>form1:txtOvernightPostCode</td>
<td>wr51dh</td>
</tr>
<tr>
<td>select</td>
<td>form1:cboVehicleCoverType</td>
<td>label=Third Party Only</td>
</tr>
<tr>
<td>select</td>
<td>form1:cboVolExcess</td>
<td>label=£300</td>
</tr>
<tr>
<td>select</td>
<td>form1:cboNCBYears</td>
<td>label=9</td>
</tr>
<tr>
<td>select</td>
<td>form1:cboNCBProtected</td>
<td>label=No</td>
</tr>
<tr>
<td>select</td>
<td>form1:cboNCBType</td>
<td>label=Motorcycle</td>
</tr>
if any one have some solution please email mail me on dhanunjayakumar#gmial.com
<tr>
<td>selectWindow</td>
<td>null</td>
<td></td>
</tr>
This piece looks problematic it should be like
<tr>
<td>selectWindow</td>
<td>name=NameOfPopupWindow</td>
<td></td>
</tr>
[error] Permission denied for http://www.netpig.co.uk to call method Location.toString on http://quotes.netpig.co.uk
Its Same Origin Policy Issue
Your popup window on http://www.netpig.co.uk is not allowed by browser to modify DOM on http://quotes.netpig.co.uk because its different domain.