I am trying to select radio buttons and select value in selectCls but facing problem with my code please help me on the same
Thanks in advance..
My VBA Code is:
Browser.document.getElementById("ddlCycleID").SelectCls = "Cycle 274 (21 Jun 2017 - 31 Jul 2017)"
Browser.document.getElementById("chkproc").Checked = True
Browser.document.getElementById("btnSubmit").Click
And HTML Source code is:
<td>
<input value="chkproc" name="Module" type="radio" id="chkproc" checked="checked" tabindex="1" onclick="toggle(this)"> Processing Module
<td>
<td>
<input value="chkquery" name="Module" type="radio" id="chkquery" tabindex="2" onclick="toggle(this)"> Other Modules
<td>
<td>
<select name="ddlCycleID" id="ddlCycleID" tabindex="4" class="SelectCls" style="width:180px;">
<option value="Select Cycle">Select Cycle</option>
<option value="274">Cycle 274 (21 Jun 2017 - 31 Jul 2017)</option>
<option value="273">Cycle 273 (29 Jun 2017 - 29 Jun 2017)</option>
</select>
<td>
getting below error msg
Run-time error '424'
object required
in this code:
Browser.document.getElementById("ddlCycleID").SelectCls = "Cycle 274 (21 Jun 2017 - 31 Jul 2017)"
showing this "="" when i place cursor on this code
Related
I've got this HTML
<div>
<div tabindex="0" class="dropdown xs-dropdown show" id="selBudgetYearRange-wrap" style="border: 1px solid rgb(206, 212, 218); border-image: none;">
<button tabindex="-1" class="btn btn-default dropdown-toggle" id="selBudgetYearRange-btn" aria-expanded="true" aria-haspopup="true" type="button" data-toggle="dropdown">2020 vs 2019 (Oct 2019 - Mar 2020 vs Oct 2018 - Mar 2019)
</button>
<div class="dropdown-menu show" id="selBudgetYearRange-dmenu" aria-labelledby="selBudgetYearRange-btn" style="left: 0px; top: 0px; width: calc(100% + 2 * 1px); margin-top: calc(0px + 1px); margin-left: calc(-0px - 1px); position: absolute; transform: translate3d(0px, 21px, 0px);" x-placement="bottom-start">
<a class="dropdown-item active" onclick="dropdownChanged(this, 'selBudgetYearRange','201910-202003,2');;return false;" href="javascript:void(0)">2020 vs 2019 (Oct 2019 - Mar 2020 vs Oct 2018 - Mar 2019)</a>
<a class="dropdown-item" onclick="dropdownChanged(this, 'selBudgetYearRange','201810-201909,2');;return false;" href="javascript:void(0)">2019 vs 2018 (Whole Year Oct - Sep)</a>
<a class="dropdown-item" onclick="dropdownChanged(this, 'selBudgetYearRange','201710-201809,2');;return false;" href="javascript:void(0)">2018 vs 2017 (Whole Year Oct - Sep)</a>
</div><input name="selBudgetYearRange" id="selBudgetYearRange" type="hidden" value="201910-202003,2"></div>
</div>
which has 3 options
2020 vs 2019 (Oct 2019 - Mar 2020 vs Oct 2018 - Mar 2019)
2019 vs 2018 (Whole Year Oct - Sep)
2018 vs 2017 (Whole Year Oct - Sep)
I've managed to work out that by using
.FindElementByXPath("//*[text()='2019 vs 2018 (Whole Year Oct - Sep)']").Click
I can select the middle option, however it only works if I click on the drop down first so that the options are visible.
I can't seem to get selenium to click on the drop down for me and make the options visible so that I can use the above xpath to select my desired option.
Please can someone advise on how to do this? Or if there's a way of selecting my options without needing to get the drop down to appear first?
So managed to get it to work.
by using clickdouble (after figuring out the xpath)
I have no idea why I need to use clickdouble instead of click.
But it works, so I'm not going to complain too much
I am working on a project where I have to fill data in a pre populated dynamic web table. I am able to find the element with the help of XPath in selenium VBA. I am able to click the element. But Whenever I Try to fill data with sendkey command I get the message "Run time error 0.Element not intractable.
When I try sendKey command with normal id of the element or CSS id then it gets accepted but when I try XPath i get the above message.
bot.FindElementByXPath("//td[contains(text(),'XYZ')]/following-sibling::td[5]").SendKeys "54"
<tr style="background-color:White;height:24px;">
<td class="gridtext" align="center">
<span class="checkboxclass"><input id="ctl00_ContentPlaceHolder1_grdUsers_ctl02_chkSelect" type="checkbox" name="ctl00$ContentPlaceHolder1$grdUsers$ctl02$chkSelect" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$grdUsers$ctl02$chkSelect\',\'\')', 0)"></span>
<input type="hidden" name="ctl00$ContentPlaceHolder1$grdUsers$ctl02$hdnUserId" id="ctl00_ContentPlaceHolder1_grdUsers_ctl02_hdnUserId" value="206451744">
</td><td align="center" style="width:2%;">
1
</td><td class="gridtext" align="center">
<span id="ctl00_ContentPlaceHolder1_grdUsers_ctl02_lblStudentId" style="display:inline-block;color:#000000;font-family:Calibri;font-size:12px;font-weight:normal;font-style:normal;width:120px;">091001118051500183</span>
</td><td class="gridtext" align="center">
</td><td class="gridtext" align="left" style="background-color:#FDE9D9;">SHIVAKSHI</td><td class="gridtext" align="left" style="background-color:#FDE9D9;">SANJAI KUMAR</td><td class="gridtext" align="left" style="background-color:#FDE9D9;">SANGEETA</td><td class="gridtext" align="left" style="background-color:#FDE9D9;">19/02/2010</td><td class="gridtext" align="center" style="background-color:#FDE9D9;">
</td><td class="gridtext" align="center">
<input name="ctl00$ContentPlaceHolder1$grdUsers$ctl02$txtNoOfDays" type="text" maxlength="3" id="ctl00_ContentPlaceHolder1_grdUsers_ctl02_txtNoOfDays" class="TextBox" onkeypress="return AllowNumeric_Browser(event, false);" onpaste="return false;" style="width:50px;">
</td><td class="gridtext" align="center">
You need to target the child input tag of the td as the td itself is not interactable. So, you need to add /input to your current path
bot.FindElementByXPath("//td[contains(text(),'XYZ')]/following-sibling::td[5]/input").SendKeys "54"
Here is a similar example where you select the child input of a td based on the parent tr having a td with specific text
bot.Get 'https://datatables.net/examples/api/form.html'
bot.FindElementByXPath("//tr[contains(td/text(), 'Angelica Ramos')]/td[2]/input").SendKeys "test"
Or
//td[contains(text(),'Angelica Ramos')]/following-sibling::td[1]/input
I have a list that I want to display in table along with radio buttons. UI Requirement is that there are grouped in table, 3 in a row. My idea was to use <p:repeat> and <p:fragment> on every third index to close last <tr> and open a new one.
Code is/was:
<table>
<tr>
<p:repeat
value="#{bean.arrayInBean}"
var="value" varStatus="status">
<td>
<span title="#{value.description}">
<input type="radio" value="#{value.code}"
name="valueName" /> #{value.code}
</span>
</td>
<p:fragment rendered="#{(status.index + 1) % 3 eq 0}">
</tr>
<tr>
</p:fragment>
</p:repeat>
</tr>
</table>
Unfortunately i get Error Parsing...The element type "p:fragment" must be terminated by the matching end-tag "</p:fragment>"
I have an ejs file that i call from node.js that seems to be doing the right thing, but not rendering the links properly.
here is the call from node.js:
res.render('response.ejs', {jsondata : isu});
here is the code on the response.ejs page
<div>
<% for(var i=0; i < jsondata.length; i++) { %>
<li>
<%= link_to(jsondata[i].time, "Entry/"+jsondata[i]._id) %>
<%= jsondata[i].location.place[0]%>
</li>
<% } %>
</div>
this is what it returns (displayed on the page):
<a href='Entry/5411f73ef0fd92861601775f' >Thu Sep 11 2014 12:25:50 GMT-0700 (PDT)</a> Woodlawn Ave N
<a href='Entry/541251980570a2ba17f02c89' >Thu Sep 11 2014 18:51:43 GMT-0700 (PDT)</a> Woodlawn Ave N
<a href='Entry/5412524d0570a2ba17f02c8b' >Thu Sep 11 2014 18:54:29 GMT-0700 (PDT)</a> Woodlawn Ave N
<a href='Entry/541253b50570a2ba17f02c8d' >Thu Sep 11 2014 19:00:32 GMT-0700 (PDT)</a> Bagley Ave N
<a href='Entry/541254c054041703194a957d' >Thu Sep 11 2014 19:04:48 GMT-0700 (PDT)</a> Russell Ave NW
<a href='Entry/541502b197ed2f8022f0b399' >Sat Sep 13 2014 19:51:29 GMT-0700 (PDT)</a> Woodlawn Ave N
but if i copy this output to a file and open it in the browser i do see the hrefs rendered as links so no idea what is going on here.
<%= %> escapes HTML, so you need to use <%- %> instead.
I have two select list that are equal how do i access the second one?
I have put a value on the first one but when putting a value to the second it goes to the first.
Anyone can help me.
<div id="selectNumber">
<select id="numbers" name="numbers" tabindex="5" onchange="changeNumbers(this);">
<option value="" selected="selected"></option>
<option value="all">25</option>
<option value="123">26</option>
<option value="124">27</option>
</select>
<a onclick="addRemoveSelectedNumber(this);">
<img src="../../static/images/delete.png">
</a>
</div>
<div id="selectNumber">
<select id="numbers" name="numbers" tabindex="5" onchange="changeNumbers(this);">
<option value="" selected="selected"></option>
<option value="all">25</option>
<option value="123">26</option>
<option value="124">27</option>
</select>
<a onclick="addRemoveSelectedNumber(this);">
<img src="../../static/images/delete.png">
</a>
Tanks
This will select 25 from the second select list:
browser.select_list(:id => "numbers", :index => 1).select "25"
More information: Multiple Attributes chapter at https://github.com/zeljkofilipin/watirbook/blob/master/link.md
By the way, you should report a bug that there are multiple instances of HTML elements with the same id on the page. Per the HTML standard, ID values should be unique