I have to assert a hidden alert in Selenium IDE. The commands suggested by IDE failed. Below mentioned is the html tag for the error message. Thanks for the Help!
<article class="alertify-log alertify-log-error alertify-log-show alertify-log- hide">ERROR: User name and password doesn't match. Please try again.</article>
Asserts that the article is present:
<tr>
<td>assertElementPresent</td>
<td>css=article[class*='hide'][class*='alertify-log-error']</td>
<td></td>
</tr>
Asserts the text is present:
<tr>
<td>assertText</td>
<td>css=article[class*='hide'][class*='alertify-log-error']</td>
<td>ERROR: User name and password doesn't match. Please try again.</td>
</tr>
Related
As part of a test scrip I have to redirect to a 3rd party hosted payment page. However, when I try and find the input box elements it errors slightly differently depending on which call I try:
$driver->find_element_by_id("card.billingAddress.houseNumberOrName")->clear
returns "Element is not currently visible and so may not be interacted with"
$driver->find_element_by_xpath('//input[#id="card.billingAddress.houseNumberOrName"')->clear
returns "SyntaxError: The expression is not a legal expression."
The source of the section I am searching is:
<tr>
<td colspan="2"><div class="fieldSubHeader">Billing Address</div>
</td>
</tr>
<tr>
<td><div id="idAddress1_card" style="display:inline">Address 1</div>
<div id="idHouseNumberOrName_card" style="display:none">House Number/Name
</div</td>
<td><div class="fieldDiv" id="idDivAddress1_card">
<input type="text" class="inputField" id="card.billingAddress.houseNumberOrName" name="card.billingAddress.houseNumberOrName" value="" size="15" maxlength="40" />
</div></td>
</tr>
Is it the . in the ID that is causing the issue?
(I have checked the computed CSS and it is not hidden!)
Many thanks
You are missing the closing ]. Replace:
'//input[#id="card.billingAddress.houseNumberOrName"'
with:
'//input[#id="card.billingAddress.houseNumberOrName"]'
HERE ^
Note that you might simplify it by switching directly to the find_element_by_id() method.
I am very new to selenium ide,How can we read excelsheet data in selenium IDE. I have searched in google but not found particular links which I wanted .I got one link where they are reading excelsheet using eclipse, junit,testNG etc. Is it possible to read data of excelsheet in selenium ide and use that data in selenium ide test cases and also i want to export my test suit result in excelsheet.
Please reply
Thank you
Though I'm late to the show, I hope the following instructions will at least be of some use to anyone looking to automate part of their workflow. The method detailed below will allow automated web form entry from data in a CSV file using only Selenium IDE.
What you'll need: 1.) Selenium IDE 2.) CSV File Reader plugin // This can be acquired at seleniumhq.org/download then proceed to download at Github 3.) Selblocks // a language extension which permits use of conditonals & looping
Now that you have the necessary tools, fire up Firefox and navigate to your Selenium IDE options. You'll want to copy the path of the File Reader (.js) to Selenium Core Extensions to enable use. With that out of the way, verify that Selblocks installed without issue by typing in "while"; if this command is recognized (i.e. auto-completes/has a reference description) then all went well. Now verify that the File reader plugin commands are accessible by typing in "readCSV"; again if it auto-completes the command that means you're good to go.
Your target for the readCSV command is the path to your file (ex: file:\C:/Test.csv). To read the entire contents of the csv file, you'll need a simple while loop. Here's a sample framework:
...
<tr>
<td>store</td>
<td>4</td>
<td>loop</td>
</tr>
<tr>
<td>store</td>
<td>1</td>
<td>p</td>
</tr>
<tr>
<td>while</td>
<td>${p}<${loop}</td>
<td></td>
</tr>
<tr>
<td>open</td>
<td>https://automatestuff.com/go </td>
<td></td>
</tr>
<tr>
<td>readCSV</td>
<td>file:\C:/Test.csv</td>
<td></td>
</tr>
<tr>
<td>storeCellValue</td>
<td>SomeData</td>
<td>${p},1</td>
</tr>
<tr>
<td>storeCellValue</td>
<td>MoreData</td>
<td>${p},2</td>
</tr>
<tr>
<td>echo</td>
<td>${SomeData}</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${MoreData}</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>${p}+1</td>
<td>p</td>
</tr>
....
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
...
Your target value (in this example, 4) for the first store command will vary given the size of your dataset. The while expression will run through your data until it evaluates to false. In this example, I have data being read from column 1, row 1 (and so on) and column 2, but it's possible to configure more or less.
Anyway, I hope that's clear and gets you on your way to automating the mundane bits of your workflow.
You can probably hack together something for this that uses javascript to read in files, but I think you should question WHY you want to do it this way instead. Why do you need excel files or why are you limited to IDE testing?
But maybe some help on excel files & javascript: How to read an excel file contents on client side?
Basically, in English I want to tell Selenium "look for the content ttc202 in column one, of a multi-row, multicolumn table, then mouseOver on the Edit link"
HTML is as follows:
<tr id="86" class="ui-widget-content jqgrow ui-row-ltr ui-state-highlight" tabindex="0" role="row" aria-selected="true">
<td aria-describedby="jqLst_Short Name" style="text-align:left;" role="gridcell">
ttc202
</td>
<td aria-describedby="jqLst_Long Name" style="text-align:left;" role="gridcell">
Testing Training Company 202
</td>
<td aria-describedby="jqLst_Actions" title="" style="text-align:center;" role="gridcell">
<a class="act avw" title="View this Organisation" href="company/view?lcId=86"></a>
<a class="act aed" title="Edit this Organisation" href="company/edit?lcId=86"></a>
</td>
</tr>
I have tried this:
//td[contains(text(),'ttc202')]/following-sibling::td[contains(a/title(),'Edit this Organisation')]/a
All help appreciated. I assume I am missing something to skip over the first column, but can't imagine what will enable me to do that...
Progress:
I have found the following as an alternative which should get to the correct cell, but I am not able to workout how to target the title in the link code:
//td[normalize-space() ="ttc202"])[1]/following-sibling::td[2]/a[. = 'Edit']
I think this is progress just not sufficient to get me to the finish line!
After much investigation I found the following answer, perhaps this might help others who come across this question:
//tr[contains(td[1], "ttc202")]/td[3]/a[#title='Edit this Organisation']
The trick was realising which cell the information was in (represented by the square brackets).
I am using SIDE 1.3.0 along with FF 6.0.2.
I stored a string using store text command which contains a "URL" by using the following command.
storeText
which results as
MyCode = "<iframe src="http://myportal.com/mysales/Agent/index/4eb29642ce24e8.22143850/embedded" height="650" width="605" frameBorder="0"></iframe>"
I need to have only the URL part in another variable from the string above "http://myportal.com/mysales/Agent/index/4eb29642ce24e8.22334455/embedded"
in order to proceed with the remaining test case. Thanks in advance.
Something like:
<tr>
<td>storeEval</td>
<td>'${MyCode}'.replace(/.*src="(.*?)".*/, $1)</td>
<td>url</td>
</tr>
This will use JavaScript to set a variable called url to the value of the src attribute within your MyCode variable.
The first command below stores the href attribute of any element, you can modify it to your needs.
The third command uses javascript to get the pathname attribute of the DOM object.
Hope this answers your question.
If you open the IDE click on the source tab in the main window and copy and paste the code below between the tags, you'll be able to run the test on this page, or any other stack overflow page.
<tr>
<td>storeAttribute</td>
<td>css=.profile-link#href</td>
<td>href</td>
</tr>
<tr>
<td>echo</td>
<td>${href}</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>this.browserbot.getUserWindow().document.getElementsByClassName('profile-link')[0].pathname</td>
<td>pathname</td>
</tr>
<tr>
<td>echo</td>
<td>${pathname}</td>
<td></td>
</tr>
I know that it's possible to create own decorator but I'm interested in is it possible to create it throught the standart error decorator?
I would like to get smth like this:
<table>
<tr>
<td><label></td>
<td><input></td>
</tr>
<tr>
<td></td>
<td><ul><li>ERROR</li></ul></td>
</tr>
</table>
Regrettably, as of ZF version 1.11.7, only a single tag is supported when it comes to wrapping forms, form elements or individual decorators. You will indeed require a custom decorator.