I am using the Selenium IDE and I cannot select an item from the kendo dropdown menu that I want. Does anybody know how to do this with the Selenium IDE? (or else in C# but I wouldn't be able to test that for a while).
Here's a website that has a dropdown that I was trying to practice on, by trying to assert some of the other dropdown options, no luck. http://derp-bear.herokuapp.com/ui_widgets/kendo_ui_example
<tr>
<td>open</td>
<td>http://derp-bear.herokuapp.com/ui_widgets/kendo_ui_example</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>css=span.k-input</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>css=span.k-input</td>
<td>XL - 7 5/8</td>
</tr>
Any help would be great!
This is not a traditional select drop down. So the dropdown and the options are in 2 different places.
Drop down arrow is located in the below code
<span class="k-select" unselectable="on">
<span class="k-icon k-i-arrow-s" unselectable="on">select</span>
</span>
Drop down arrow can be selected with the css
css=span.k-select
Drop down options are located in the below location. This section is activated after clicking on the drop down arrow.
<ul class="k-list k-reset" unselectable="on" style="overflow: auto;" tabindex="-1" role="listbox" aria-hidden="true" id="size_listbox" aria-live="off">
<li class="k-item" unselectable="on" role="option" tabindex="-1">S - 6 3/4</li>
<li class="k-item" unselectable="on" role="option" tabindex="-1">M - 7 1/4</li>
<li class="k-item k-state-selected k-state-focused" unselectable="on" role="option" tabindex="-1" id="size_option_selected" aria-selected="true">L - 7 1/8</li>
<li class="k-item" unselectable="on" role="option" tabindex="-1">XL - 7 5/8</li>
</ul>
Any of the 4 drop down options can be selected with the xpath
xpath=//li[#class='k-item'][.='L - 7 1/8']
Selenium IDE code will be as follows:
<tr>
<td>open</td>
<td>/ui_widgets/kendo_ui_example</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>css=span.k-select</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>3000</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>xpath=//li[#class='k-item'][.='XL - 7 5/8']</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>3000</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>css=span.k-input</td>
<td>XL - 7 5/8</td>
</tr>
Use pause to wait for stuff to load.
Related
I'm trying to get the value qty of products shipped to display as an additional column in the invoice report. Not sure if its as simple as finding out what variable it is or what. Is there any easy way to reference what variables are available for the current views?
<table class="table table-condensed">
<thead>
<tr>
<th>Description</th>
<th class="hidden">Source Document</th>
<th class="text-right">Ordered</th>
<th class="text-right">Shipped</th>
<th class="text-right">Backorder</th>
<th class="text-right">Unit Price</th>
<th t-if="display_discount" class="text-right">Disc.(%)</th>
<th class="text-right">Extended Price</th>
</tr>
</thead>
<tbody class="invoice_tbody">
<tr t-foreach="o.invoice_line_ids" t-as="l">
<td><span t-field="l.name"/></td>
<td class="hidden"><span t-field="l.origin"/></td>
<td class="text-right">
<span t-field="l.quantity"/>
<span t-field="l.uom_id" groups="product.group_uom"/>
</td>
<td class="text-right">
<span t-field="o.delivery_count"/>
</td>
<td class="text-right">
</td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td t-if="display_discount" class="text-right">
<span t-field="l.discount"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal" t-options="{"widget": "monetary", "display_currency": o.currency_id}"/>
</td>
</tr>
</tbody>
I don't exactly know what you mean with "products shipped" but you can get the quantity of the invoice lines to your report like this:
<t t-foreach="o.invoice_line_ids" t-as="l">
<span t-field="l.quantity"/>
</t>
Same for the stock picking lines quantity:
<t t-foreach="o.move_lines" t-as="l">
<span t-field="l.product_uom_qty"/>
</t>
One easy way to get the variable names is to activate the develop mode and placing the cursor over a field label.
You can also go to Settings->Database Structure->Models then just pick your needed model to see the variable names (field names).
I'm new to Selenium IDE and I need to run some test on one website. Everything seems to work just fine except the part where I need to select my location since that list is powered by Google I can't really get the object by list id..
Here's my test so far:
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=newregister-form-email</td>
<td>javascript{"test+" + Math.floor(Math.random()*11111) + "#gmail.com";}</td>
</tr>
<tr>
<td>type</td>
<td>id=newregister-form-pass</td>
<td>test</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>css=input.submitLogin</td>
<td></td>
</tr>
<tr>
<td>waitForPageToLoad(1000)</td>
<td></td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=u_users-form-name</td>
<td>Tester</td>
</tr>
<tr>
<td>type</td>
<td>id=u_users-form-surname</td>
<td>Test</td>
</tr>
<tr>
<td>type</td>
<td>id=u_users-form-phone</td>
<td>javascript{"+3706" + Math.floor(Math.random()*11111);}</td>
</tr>
<tr>
<td>type</td>
<td>id=cityinput</td>
<td>Vilnius</td>
</tr>
<tr>
<td>pause</td>
<td>1000</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=cityinput</td>
<td>Vilnius</td>
</tr>
The last part is where I need to choose from the dropdown list but Selenium IDE doesn't see it when recording.
Thank you in advance
Update:
This is html code of the city input :
<div class="row field">
<div class="col-xs-12 col-sm-8 col-sm-offset-4 col-md-offset-3 formelement-wrapper">
<input type="text" id="u_users-form-country" name="u_users-form[country]" value="" />
</div>
</div>
<div class="row field">
<div class="col-xs-12 col-sm-8 col-sm-offset-4 col-md-offset-3 formelement-wrapper">
<input type="text" id="u_users-form-city" name="u_users-form[city]" value="" />
</div>
</div>
<div class="row field">
<div class="col-xs-12 col-sm-8 col-sm-offset-4 col-md-offset-3 formelement-wrapper">
<input type="text" id='cityinput' placeholder="Miestas, Šalis">
</div>
</div>
instead of a pause you should use a waitForElementPresent on id=cityinput. This will allow you to wait until that element is present and not just 1 second (as your pause is currently doing)
<tr>
<td>waitForElementPresent</td>
<td>id=cityinput</td>
<td></td>
</tr>
Thanks for taking the time to ready my questions. I need to mouseover then mousedown on an image (cog.png) for a specific node child represented by text to the right of an image. I can successfully Target the class but cannot work out how to target the image alone.
HTML, I want to target the cog.png near 'Australia'
<div id="tree" class="">
<ul class="dynatree-container dynatree-no-connector">
<li class="dynatree-lastsib">
<span class="dynatree-node dynatree-expanded dynatree-has-children dynatree-lastsib dynatree-exp-el dynatree-ico-e"></span>
<ul style="">
<li class="">
<span class="dynatree-node dynatree-exp-c dynatree-ico-c" style="background-color: transparent;">
<span class="dynatree-connector"></span>
<img alt="" src="/icn/cog.png"></img>
<a class="dynatree-title" title="This option is Active" href="#">
Australia
</a>
</span>
Target code for Selenium IDE (which targets the full span, I just want the image cog.png)
//span[contains(#class,'dynatree-node') and //img[#src='/icn/cog.png'] and .//text()='Australia']
I tried
//img[#src='/icn/cog.png']
Not surprisingly it was not specific enough and targeted the first instance of the image
Versions
Firefox 32.0.3
Selenium IDE: 2.7.0
This is the code that I used to navigate on the dynatree, it wsa made more difficult as the first item was added as a child, the remainder added below or above the child. I kept track by creating 'counts' to determine at what point the items were added.
<tr>
<td>waitForTextPresent</td>
<td>Australia</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//span/a[contains(., '${LocationLevel1Ext}')]/preceding::span[#class='dynatree-expander'] [1]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//span/a[contains(., '${LocationLevel2Ext}')]/preceding::span[#class='dynatree-expander'] [1]</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>//span/a[contains(., '${PreviousLocationName}')]/preceding::img[#src='/icn/cog.png'] [1]</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>Add before this node</td>
<td></td>
</tr>
<tr>
<td>mouseOver</td>
<td>//span[contains(text(), 'Add before this node')]</td>
<td></td>
</tr>
<tr>
<td>mouseDown</td>
<td>//span[contains(text(), 'Add before this node')]</td>
<td></td>
</tr>
Name Mobile No Introducer Created On Status Action
Adill 6666655555 Nitesh 05-02-2014 Pending For Approval [button]
Adill 6666644444 Nitesh 05-02-2014 Pending For Approval [button]
the situation is like this, I want to click on buttons by checking their unique mobile no.
let suppose I want to click on button2 where mobile number is 666644444. So How can I perform this thing ?
enter code here :
<tr class="even">
<td class="">Adil Imroz</td>
<td class="">999933333</td>
<td class="">Adil</td>
<td class=" sorting_1">04-02-2014</td>
<td class="">
<span class="undefined">Pending For Approval</span>
</td>
<td class="">
<a id="editCustomerDetails" class="btn btn-info btn-small" onclick="showUpdateForm(2);">
<i class="halflings-icon edit halflings-icon"/>
</a>
</td>
</tr>
<tr class="odd">
<td class="">Adil Imroz</td>
<td class="">9999444444</td>
<td class="">Adil</td>
<td class=" sorting_1">04-02-2014</td>
<td class="">
<span class="undefined">Pending For Approval</span>
</td>
<td class="">
<a id="editCustomerDetails" class="btn btn-info btn-small" onclick="showUpdateForm(3);">
</td>
I hope someone here can help me. Im using selenium to test a page that has an image which when click displays a calendar. I can get as far as clicking the image using
browser.click("//center/table/tbody/tr/td[1]/a/img")
I got the above path by using the Selenium IDE. The problem is once i click the above image the Selenium IDE does not record what i have clicked after the calendar is shown.
Here is the code for the image button
<INPUT size='8' CLASS="field-date" TYPE="text" NAME="endQtrDate" VALUE="01/10/2004" ID="endQtrDate" onBlur="this.value=validateFieldValue(this.value,'date_error','endQtrDate',this.form)" onFocus="this.select()" TITLE="Enter date in format dd/mm/yyyy" />
<IMG ALIGN="absmiddle" ALT="Press to show calendar picker" NAME="calendarButton" SRC="../images/buttons/small/calendar.gif" onClick="return showCalendar('endQtrDate', 'dd/MM/yyyy');" />
Unfortunately i cant see the code for the calendar after i click it. The only way i can see it is using the mozilla plugin "Firebug". I managed to get the div layer of which the calendar is displayed.
<div class="calendar"
style="position: absolute; display: none; left: 234px; top: 416px;">
<table cellspacing="0" cellpadding="0">
<thead>
<tr>
<td colspan="1" class="button">-</td>
<td colspan="6" class="title" style="cursor: move;">October,
2004</td>
<td colspan="1" class="button">×</td>
</tr>
<tr class="headrow">
<td colspan="1" class="button">«</td>
<td colspan="1" class="button">‹</td>
<td colspan="4" class="button">Today</td>
<td colspan="1" class="button">›</td>
<td colspan="1" class="button">»</td>
</tr>
<tr class="daynames">
<td class="name wn">wk</td>
<td class="day name">Mon</td>
<td class="day name">Tue</td>
<td class="day name">Wed</td>
<td class="day name">Thu</td>
<td class="day name">Fri</td>
<td class="name day weekend">Sat</td>
<td class="name day weekend">Sun</td>
</tr>
</thead>
<tbody>
<tr class="daysrow">
<td class="day wn">40</td>
<td class="day"> </td>
<td class="day"> </td>
<td class="day"> </td>
<td class="day"> </td>
<td class="day">1</td>
<td class="day weekend">2</td>
<td class="day weekend">3</td>
</tr>
<tr class="daysrow">
<td class="day wn">41</td>
<td class="day">4</td>
<td class="day">5</td>
<td class="day">6</td>
<td class="day">7</td>
<td class="day">8</td>
<td class="day weekend">9</td>
<td class="day weekend">10</td>
</tr>
<tr class="daysrow">
<td class="day wn">42</td>
<td class="day">11</td>
<td class="day">12</td>
<td class="day">13</td>
<td class="day">14</td>
<td class="selected day">15</td>
<td class="day weekend">16</td>
<td class="day weekend">17</td>
</tr>
<tr class="daysrow">
<td class="day wn">43</td>
<td class="day">18</td>
<td class="day">19</td>
<td class="day">20</td>
<td class="day">21</td>
<td class="day">22</td>
<td class="day weekend">23</td>
<td class="day weekend">24</td>
</tr>
<tr class="daysrow">
<td class="day wn">44</td>
<td class="day">25</td>
<td class="day">26</td>
<td class="day">27</td>
<td class="day">28</td>
<td class="day">29</td>
<td class="day weekend">30</td>
<td class="day weekend">31</td>
</tr>
<tr class="emptyrow">
<td class="day wn">36</td>
<td class="day">30</td>
<td class="day">31</td>
<td class="day"> </td>
<td class="day"> </td>
<td class="day"> </td>
<td class="day"> </td>
<td class="day"> </td>
</tr>
</tbody>
<tfoot>
<tr class="footrow">
<td colspan="8" class="ttip" style="cursor: move;">Select date</td>
</tr>
</tfoot>
</table>
<div class="combo" style="display: none;">
<div class="label">Jan</div>
<div class="label">Feb</div>
<div class="label">Mar</div>
<div class="label">Apr</div>
<div class="label">May</div>
<div class="label">Jun</div>
<div class="label">Jul</div>
<div class="label">Aug</div>
<div class="label">Sep</div>
<div class="label">Oct</div>
<div class="label">Nov</div>
<div class="label">Dec</div>
</div>
<div class="combo" style="display: none;">
<div class="label"></div>
<div class="label"></div>
<div class="label"></div>
<div class="label"></div>
<div class="label"></div>
<div class="label"></div>
<div class="label"></div>
<div class="label"></div>
<div class="label"></div>
<div class="label"></div>
<div class="label"></div>
<div class="label"></div>
</div>
</div>
If you look carefully you will see table cells for dates from 1 to 30th. How can i access these values using Selenium? I can use the IDE as it doesnt record anything when the calendar pops up.
The firebug has an option to display the xpath of any tag. I tried it on one of the td tags and it says this is the xpath.
/html/body/div/table/thead/tr[2]/td[3]
Can i use the above path to determine its value then click on it using selenium?
Thanks
To click on the image you can use click | calendarButton and that should load it up for you.
From there you will then need to click on items I would then use firebug to see the other items on the page.
Edit from extra info:
What you need to do then is use xpath=//td[#class="day" and text()="14"] for xpath or for css use css=td.day:contains('14')
The css route will be a lot quicker in browsers like Internet Explorer