select radio buttons using vba - vba

Sub Mind_stone()
Dim IE As Object
Dim doa As HTMLDocument
Dim HTMLdoc As HTMLDocument
Dim button As HTMLInputButtonElement
Dim i As Integer
Set IE = CreateObject("internetexplorer.application")
IE.Visible = True
IE.navigate "https://eqvm.titusn.co.in/PavbnjsPnrtl/login.jsp"
Do While IE.busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.document.getElementById("username").Value = "efeqwf"
IE.document.getElementById("password").Value = "*****"
IE.document.getElementsByClassName("button ok")(0).Click
IE.document.querySelector("[title='PSR - Indirect Materials']").Click
'IE.document.getElementsByClassName("dijitReset dojoxMultiSelectItem")(1).Click
'IE.document.querySelector("[title='div_3_1_2_radiogroup']").Click
'itemlength = IE.document.all.Item("div_3_1_2_radiogroup").Length
'IE.document.getElementsByName("div_3_1_2_radiogroup").Item(1).Checked = True
End Sub
<div class="dijitReset dojoxMultiSelectItem BPMMultiSelectFocused dojoxCheckedMultiSelectSelectedOption" id="dojox_form__CheckedMultiSelectItem_7" widgetid="dojox_form__CheckedMultiSelectItem_7" aria-selected="true">
<div class="dijit dijitReset dijitInline dojoxMultiSelectItemBox dijitRadio dijitRadioChecked dijitChecked" role="presentation" widgetid="dijit_form_CheckBox_7">
<input
type="radio"
class="dijitReset dijitCheckBoxInput"
data-dojo-attach-point="focusNode"
data-
<div
class="dijit dijitReset dijitInline dojoxMultiSelectItemBox dijitRadio dijitRadioChecked dijitChecked"
role="presentation"
widgetid="dijit_form_CheckBox_7"
/>
<input
type="radio"
class="dijitReset dijitCheckBoxInput"
data-dojo-attach-point="focusNode"
data-dojo-attach-event="onclick:_onClick"
value="on"
tabindex="0"
id="dijit_form_CheckBox_7"
aria-labelledby=" dijit_form_CheckBox_7_radio_label"
name="div_3_1_2_radiogroup"
aria-checked="true"
style="user-select: none;"
/>
</div>
<input
type="radio"
class="dijitReset dijitCheckBoxInput"
data-dojo-attach-point="focusNode"
data-dojo-attach-event="onclick:_onClick"
value="on"
tabindex="0"
id="dijit_form_CheckBox_7"
aria-labelledby=" dijit_form_CheckBox_7_radio_label"
name="div_3_1_2_radiogroup"
aria-checked="true"
style="user-select: none;"
/>
<div class="dijitInline dojoxMultiSelectItemLabel" data-dojo-attach-point="labelNode" data-dojo-attach-event="onclick:_onClick" id="dijit_form_CheckBox_7_radio_label">Create New / Create from existing PSR</div>
</div>
i am new to the web-scraping , now i am trying to click the radio button through vba but i cant find the solution to that
for the first 4 stage (username,password,button ok,title) i have successfully passed but i am struggling for the above code
Second one is which i'am trying to click

Related

Images for after clicking on suboption from the popup window remains as it is in selenium

In my application left-hand side menu bar which contain 8 modules of an application. And each of module contain suboptions.
I am trying to click on one of suboption from a particular module which having 30 suboptions(pages).
But after clicking on a particular option the popup window remains as it is on screen and it does not allow me to click the options which are behind the popup screen.
Behind popup screen the dropdown option is there and want to select one option from that dropdown.
Its giving me an error "org.openqa.selenium.JavascriptException: javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite."
Here is the code
//div[#id='main-nav']/ul --Gives me 6 modules name(6 ul):
<ul class="main-nav-gray-border user-details-menu-tab left-nav-main-menu-container left-nav-img-ul" xpath="1"></ul>
<ul class="main-nav-gray-border menu-items-main-menu-list left-nav-main-menu-container left-nav-img-ul" xpath="2">
<li class="main-nav-img-label" id="admin-nav">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="main-nav-icons"></svg>
<label>
Analytics
</label>
<ul class="nav-items admin-menu-items" style="top: 50px;" id="admin-menu-items">
<li class="side-nav-titles"></li>
<a class="module-item-child selected-nav-item" href="#" id="QualityMeasures37" onclick="loadModule('Analytics/Index?dashboardUrlId=71', 2,'QualityMeasures', 37,null,'Quality Measures')" xpath="1">
<li>**Quality Measures**</li>
</a>
<a class="module-child " id="QualityMainView38" onclick="loadModule('Analytics/Index?dashboardUrlId=93', 2,'QualityMainView', 38,null,'Quality Main View')"></a>
<a class="module-child " id="QualityRanking39" onclick="loadModule('Analytics/Index?dashboardUrlId=94', 2,'QualityRanking', 39,null,'Quality Ranking')"></a>
<a class="module-child " id="QualityTrending40" onclick="loadModule('Analytics/Index?dashboardUrlId=95', 2,'QualityTrending', 40,null,'Quality Trending')"></a>
<a class="module-child user-default-module selected-nav-item" href="#" id="DetailedFinanceAndUtilization41" onclick="loadModule('Analytics/Index?dashboardUrlId=76', 2,'DetailedFinanceAndUtilization', 41,null,'Detailed Finance & Utilization')"></a>
<a class="module-child " id="DetailedFinanceandUtilizationPro42" onclick="loadModule('Analytics/Index?dashboardUrlId=77', 2,'DetailedFinanceandUtilizationPro', 42,null,'Detailed Finance & Utilization Professional')"></a>
<a class="module-child " id="PartAClaimsAnalysis43" onclick="loadModule('Analytics/Index?dashboardUrlId=87', 2,'PartAClaimsAnalysis', 43,null,'Facility Claims Analysis')"></a>
</ul>
</li>
</ul>
<ul class="main-nav-gray-border menu-items-main-menu-list left-nav-main-menu-container left-nav-img-ul" xpath="3"></ul>
<ul class="icon-minimizer" id="minimizer-nav" xpath="7"></ul>
This the code for a drop down menu.
<div class="dd-select" style="width: 100px; background: rgb(245, 245, 245);" xpath="1">
<input class="dd-selected-value" type="hidden" value="Level1"><a class="dd-selected"><label class="dd-selected-text" title="Enterprise">Enterprise</label></a>
<span class="dd-pointer dd-pointer-down"></span></div>
This is the code to select the option from drop down menu.
<div id="SelectedHierarchyLevelName" class="dd-container" style="width: 100px;" xpath="1">
<div class="dd-select" style="width: 100px; background: rgb(245, 245, 245);">
<input class="dd-selected-value" type="hidden" value="Level3">
<a class="dd-selected">
<label class="dd-selected-text" title="Facility">**Facility**</label></a>
<span class="dd-pointer dd-pointer-down dd-pointer-up"></span></div>
<ul class="dd-options dd-click-off-close" style="min-width: 100px; height: 150px; overflow: auto; box-shadow: rgba(0, 0, 0, 0.176) 0px 6px 16px; display: block;">
<li class=""><a class="dd-option"> <input class="dd-option-value" type="hidden" value="Level1"> <label class="dd-option-text">Enterprise</label></a></li>
<li class=""><a class="dd-option"> <input class="dd-option-value" type="hidden" value="Level2"> <label class="dd-option-text">Ministry</label></a></li>
<li class=""><a class="dd-option dd-option-selected"> <input class="dd-option-value" type="hidden" value="Level3"> <label class="dd-option-text">Facility</label></a></li>
<li class=""><a class="dd-option"> <input class="dd-option-value" type="hidden" value="Level4"> <label class="dd-option-text">Med Group/Division</label></a></li>
<li class="hideMe"><a class="dd-option"> <input class="dd-option-value" type="hidden" value="Missing Providers"> <label class="dd-option-text">Missing Providers</label></a></li>
<li class=""><a class="dd-option"> <input class="dd-option-value" type="hidden" value="Help"> <label class="dd-option-text">Help</label></a></li>
<li class="hideMe"><a class="dd-option"> <input class="dd-option-value" type="hidden" value="L0Simulation"> <label class="dd-option-text">Unknown Simulation</label></a></li></ul></div>
I tried following:
#FindBy(id="admin-nav")
WebElement mouseHover;
#FindBy(xpath="//a[#id='QualityMeasures37']//li[contains(text(),'Quality Measures')]")
WebElement btnQualityMeasure;
#FindBy(xpath="//div[#id='SelectedHierarchyLevelName']//span[#class='dd-pointer dd-pointer-down']")
WebElement dropDown;
#FindBy(xpath="//label[contains(text(),'Facility')]")
WebElement facilityOption;
public void hoverTest() throws Exception
{
Actions act = new Actions(driver);
act.moveToElement(mouseHover).build().perform();
Thread.sleep(2000);
// ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView(true);", btnQualityMeasure);
// Thread.sleep(1000);
act.moveToElement(btnQualityMeasure).click().build().perform(); //clicking on suboption
Thread.sleep(10500);
}
public void clickDropDownButton()
{
Actions act = new Actions(driver);
act.moveToElement(dropDown).click().build().perform();
}
public void selectFromDropDown() throws Exception{
Actions act1 = new Actions(driver);
// ((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView(true);", ministryOption);
// Thread.sleep(1000);
act1.moveToElement(ministryOption).click().build().perform();
Thread.sleep(1500);
//The first method Mousehover it and select the desired suboption.
Second method clicking on dropdown button and 3rd method selecting the option from drop down.
In short from the 'Analytics' module the suboption 'Quality Measure' should be select and on that page click on one drop down menu and select the option 'Facility'. I highlighted as bold all 3 in my above code.
Its giving me an eroor "Its giving me an error "org.openqa.selenium.JavascriptException: javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite."
Also some time it does not open the desired suboption.
Any help will be appreciated.

Trouble selecting a hidden menu item using SeleniumBasic for vba

I am having some trouble selecting a hidden menu item on a work webpage using SeleniumBasic for vba. I have tried to use WebDriver.Mouse.MouseTo to hover over each menu option so that I can select the object nested "beneath" it, but after the first hover the object cannot be found.
In the picture below I intend to navigate like this:
Pricing Admin
System Admin
Multi-PAG Upload
To do this, I have to hover over Pricing Admin and subsequently hover over System Admin so that menu appears to click on Multi-PAG Upload. I have successfully gotten the driver to hover over Pricing Admin which brings up first menu list with three items ending in System Admin. However, trying to FindElement() for System Admin so that I can hover on it has proven very difficult.
I tend get an object required error or an XPath selector invalid depending on the method that I attempt. I start having problems at Set systemAdmin =.
Any advice would be welcome!
Public Sub SeleniumTest()
Dim driver As New WebDriver
'open chrome to site
driver.start "chrome"
driver.Get "http://www.website.net"
'login
driver.FindElementByName("j_username").SendKeys ("user")
driver.FindElementByName("j_password").SendKeys ("pass")
driver.FindElementById("submit_button").Click
'hover over Pricing Admin
Dim pricingAdmin As WebElement
Set pricingAdmin = driver.FindElementById("prcngAdmMnuFrm:prcngAdmMnu")
driver.Mouse.MoveTo pricingAdmin
Dim systemAdmin As WebElement
'neither selection method below works properly
' Set systemAdmin = driver.FindElementByXPath("//*[contains(text(),'System Admin')]")
' Set systemAdmin = driver.FindElementByXPath("//div[#id='prcngAdmMnuFrm:prcngAdmMnu']/div/div/ul/li/ul/li[3]/ul/li[4]/a/span/span")
driver.Mouse.MoveTo systemAdmin
Dim multiPagUpload As WebElement
' Set multiPagUpload = driver.FindElement("??")
multiPagUpload.Click
'closes browser window
driver.Quit
End Sub
Here is the (abridged) HTML for the site. I trimmed out a bit of the lists for simplicity's sake but if it's actually necessary (for using javascript, etc) let me know and I can pop more in.
<div id="prcngAdmMnuFrm:prcngAdmMnu" style="">
<div class="ui-widget ui-widget-content wijmo-wijmenu ui-corner-all ui-helper-clearfix wijmo-wijmenu-horizontal" aria-activedescendant="ui-active-menuitem" role="menubar">
<div class="scrollcontainer checkablesupport">
<ul style="display: block;" class="wijmo-wijmenu-list ui-helper-reset" tabindex="0">
<li role="menuitem" class="ui-widget wijmo-wijmenu-item ui-state-default ui-corner-all wijmo-wijmenu-parent" aria-haspopup="true" style="">
<a href="#" class="wijmo-wijmenu-link ui-corner-all" id="">
<span class="wijmo-wijmenu-text">
<span class="wijmo-wijmenu-text">Pricing Admin</span>
</span>
<span class="ui-icon ui-icon-triangle-1-s"></span>
</a>
<ul class="wijmo-wijmenu-list ui-widget-content ui-corner-all ui-helper-clearfix wijmo-wijmenu-child" style="display: none; left: 0px; top: 38px; position: absolute; list-style-type: none;" aria-hidden="true">
<li role="menuitem" class="ui-widget wijmo-wijmenu-item ui-state-default ui-corner-all wijmo-wijmenu-parent" aria-haspopup="true" style="">
<a href="#" class="wijmo-wijmenu-link ui-corner-all ui-state-focus">
<span class="wijmo-wijmenu-text">
<span class="wijmo-wijmenu-text">System Admin</span>
</span>
<span class="ui-icon ui-icon-triangle-1-e"></span>
</a>
<ul class="wijmo-wijmenu-list ui-widget-content ui-corner-all ui-helper-clearfix wijmo-wijmenu-child" style="display: none; left: 215px; top: -1px; position: absolute; list-style-type: none;" aria-hidden="true">
<li role="menuitem" class="ui-widget wijmo-wijmenu-item ui-state-default ui-corner-all">
<a onclick="showProcessingMessage('Loading');;var self = this; setTimeout(function() { var f = function(opt){ice.ace.ab(ice.ace.extendAjaxArgs({"source":"prcngAdmMnuFrm:menu_pad_sa_multi","execute":'#all',"render":'#all',"event":"activate"}, opt));}; f({node:self});}, 10);" style="cursor:pointer;" class="wijmo-wijmenu-link ui-corner-all">
<span class="wijmo-wijmenu-text">
<span class="wijmo-wijmenu-text">Multi-PAG Upload</span>
</span>
</a>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<script type="text/javascript">
var widget_prcngAdmMnuFrm_prcngAdmMnu = ice.ace.create("Menubar", ["prcngAdmMnuFrm:prcngAdmMnu", {
"autoSubmenuDisplay": true,
"direction": "auto",
"animation": {
"animated": "fade",
"duration": 400
}
}]);
</script>
</div>
If I've left anything out that you need to troubleshoot, please let me know!
The xpath which is used in the code is not correct. my suggesting to find the anchor element and move the mouse over.
# System Admin Menu
'Hover over Pricing Admin
Dim systemAdmin As WebElement
Set systemAdmin = driver.FindElementByXPath("//a[.//span[contains(.,'System Admin')]]")
driver.Mouse.MoveTo pricingAdmin
If the mouse hover does not work, we can still try to handle the menu by clicking on the anchor element and then sendkeys (keys.Arrow_Right)
#Multi-PAG Upload
Dim multiPagUpload As WebElement
Set multiPagUpload = driver.FindElementByXPath("//a[.//span[contains(.,'Multi-PAG Upload')]]")
multiPagUpload.Click

Right syntax in HTML scraping

I have a code which dynamically changing
<tbody>
' ------------------- Block 1 ----------------------
<tr class="table-row">
<td class="cell">
<div>18/4/2018</div>
</td>
<td class="cell">
<div>
<form id="idc" method="post" action=""> ' id is dinamic so cant use it
<div style=""><input type="hidden" name="idc_hf_0" id="idc_hf_0" /></div> ' id and name is dinamic so cant use them
Download all invoice documents as ZIP-file
<span>
<a class="icon zipdownload" title="Download all invoice documents as ZIP-file" href=""></a>
</span>
<span class="has-explanation">
<a class="helper" href="javascript:;" title="The zip-file contains only PDF files of Tax/Fee statements and the Fleet Invoice with all annexes if available.">
<span class="icon question" id="table-header-explanation"></span>
</a>
</span>
</form>
</div>
</td>
<td class="cell">
<div>
<a class="" title="View >>" href="">View >></a>
</div>
</td>
</tr>
' ################### Block1 END #######################
' ------------------- Block 2 ----------------------
<tr class="table-row">
<td class="cell">
<div>13/4/2018</div> ' need this
</td>
<td class="cell">
<div>
<form id="idd" method="post" action="">
<div style=""><input type="hidden" name="idd_hf_0" id="idd_hf_0" /></div>
<div>
<span>Collective Payment Order</span> (<span>2018-500421707</span>)
<span>
<span class="invisible"> | </span><span>
<a class="Download" title="Download" href="">English</a>
</span>
</span>
</div>
<div>
<span>Tax/Fee CSV list</span> <span>
<a class="icon csv" title="Download" href=""></a> ' need this HREF1
</span>
</div>
<div>
<span>Detailed Trip CSV list</span> <span>
<a class="icon csv" title="Download" href=""></a> ' need this HREF2
</span>
</div>
Download all invoice documents as ZIP-file
<span>
<a class="icon zipdownload" title="Download all invoice documents as ZIP-file" href=""></a>
</span>
<span class="has-explanation">
<a class="helper" href="javascript:;" title="The zip-file contains only PDF files of Tax/Fee statements and the Fleet Invoice with all annexes if available.">
<span class="icon question" id="table-header-explanation"></span>
</a>
</span>
</form>
</div>
</td>
<td class="cell">
<div>
<a class="" title="View >>" href="">View >></a>
</div>
</td>
</tr>
' ################### Block2 END #######################
<tbody>
So there are two blocks which are dynamic. So can be such structure
Block1
Block1
Block2
Block1
Block2
Block2
Block2
Block1
I need get from this blocks:
Count of Block2
Date of each block2
HREF1 from class="icon csv"
HREF2 from class="icon csv"
differentiate between block 1 and 2 Block 1 does not have
class="icon csv" or by <span>Tax/Fee CSV list</span> <span>
I confused how to use getelement properties, trying to get
Set IeDoc = IeApp.Document
With IeDoc
Set IeTbody = .getElementsByTagName("tbody").getElementsByClassName("table-row")
d = IeTbody.legth
For Each stEl In IeTbody
Next stEl
End With
But got error "Object does not support this property or method", maybe use better querySelector?
How is got links?
logical it must be something like
Set IeDoc = IeApp.Document
With IeDoc
Set Blocks = .getElementsByTagName("tbody")
For Each block In Blocks
Set hasClass = .getElementsByClassName("table-row").getElementsByClassName("cell")(1).getElementsByClassName("icon csv")
if not hasClass is nothing then
b.Date = Blocks(block).getElementsByClassName("table-row").getElementsByClassName("cell")(0).getElementsByTagName("div")(0).innerText()
b.Href1 = Blocks(block).getElementsByClassName("table-row").getElementsByClassName("cell")(1).getElementsByClassName("icon csv")(0)
b.Href2 = Blocks(block).getElementsByClassName("table-row").getElementsByClassName("cell")(1).getElementsByClassName("icon csv")(1)
end if
Next block
End With
So this isn't very robust but was a play around with Regex and parsing the HTML you gave. Look behind would help to pull in date with regex split but I couldn't work that out at present. I have currently adapted a regex function by #FlorentB
Public Matches As Object
' Or add in Tools > References > VBScript Reg Exp for early binding
Public Sub testing()
Dim str As String, countOfBlock2 As Long, arr() As String, i As Long
str = Range("A1") 'I am reading in from sheet but this would be your response text
arr = SplitRe(str, "\<div>[\d]+[\/-][\d]+[\/-][\d]+\<\/div>") 'look behind would help
For i = LBound(arr) To UBound(arr)
If InStr(1, arr(i), "class=""icon csv""") > 0 Then
countOfBlock2 = countOfBlock2 + 1 ' "Block 2"
Debug.Print Replace(Replace(Matches(i - 1), "<div>", ""), "</div>", "") 'dates from Block 2
Debug.Print Split(Split(arr(i), """icon csv"" title=""Download"" href=")(1), "></a>")(0)
Debug.Print Split(Split(arr(i), """icon csv"" title=""Download"" href=")(2), "></a>")(0)
End If
Next i
Debug.Print "count of block2 = " & countOfBlock2
End Sub
'https://stackoverflow.com/questions/28107005/splitting-string-in-vba-using-regex?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
Public Function SplitRe(Text As String, Pattern As String, Optional IgnoreCase As Boolean) As String()
Static re As Object
If re Is Nothing Then
Set re = CreateObject("VBScript.RegExp")
re.Global = True
re.MultiLine = True
End If
re.IgnoreCase = IgnoreCase
re.Pattern = Pattern
SplitRe = Strings.Split(re.Replace(Text, ChrW(-1)), ChrW(-1))
Set Matches = re.Execute(Text)
End Function
Output:

VBA to click on a button in IE with no ID, Name, ClassName

I need to click on a button in IE. I tried few options with no success. Everything i tried are using TagName/ ClassName/ Name/ ID. But I don't find any of these in the below.
<FORM method=post name=frmSearch action=searchResultsSummary>
<INPUT type=hidden value=GMT+01:00 name=clitz>
<DIV style="MARGIN-LEFT: 30px">
<DIV style="MARGIN-BOTTOM: 10px; FONT-WEIGHT: bold">Common Criteria</DIV>
<TABLE style="MARGIN-LEFT: 20px" cellSpacing=5 cellPadding=0 border=0>
<TBODY>
<TR>
<TD id=oDocumentCategoryCell style="HEIGHT: 22px" colSpan=3 noWrap>Document category:</TD>
<TD colSpan=3 align=left>
<SELECT style="DISPLAY: block" name=docCategory old_value="2">
<OPTION value=%>Any Category</OPTION>
<OPTION value=FINANCE>Finance Document</OPTION>
<OPTION selected value=INBOUND>Inbound Document</OPTION>
<OPTION value=PROCESS>Internal Process</OPTION>
<OPTION value=OUTBOUND>Outbound Document</OPTION>
</SELECT>
</TD>
<TD style="WIDTH: 15px"></TD>
<TD>
<INPUT onclick="javascript:if (!validateSearchForm()) return;if (!checkCountOfDays()) return; addRefKeysToForm(frmSearch); frmSearch.submit();" style="WIDTH: 100px" type=button value=Search>
</TD></TR>
<TR>
<TD style="HEIGHT: 22px" colSpan=3 noWrap>Document type:</TD>
<TD colSpan=3 align=left>
<SELECT style="DISPLAY: block" name=docType old_value="0">
<OPTION selected value=%>Any Type</OPTION>
<OPTION value=CSN_ORD_VALID>CSN Order Validation</OPTION>
<OPTION value=CREDIT_ORD>Credit Order</OPTION>
<OPTION value=EOI_ORDCPY>EOI Order Copy</OPTION>
<OPTION value=LEASE_ORD>Lease Order</OPTION>
<OPTION value=ORDER_REPORT>Order Load Report</OPTION>
<OPTION value=TRADE_ORD>Trade Order</OPTION>
<OPTION value=WATSON>WATSON Quote</OPTION>
<OPTION value=WATSON_UPDATE>WATSON Update Quote</OPTION>
<OPTION value=WNGQ>WNGQ Request</OPTION></SELECT> </TD></TR>
<TR>
I tried going by input tags and it is not working.
I used the below code. It clicks on the button i want but it is not considering the values i gave before clicking on submit button.
Dim btnInput As MSHTML.HTMLInputElement
Dim frm As MSHTML.IHTMLElementCollection
Application.ScreenUpdating = True
Set frm = ie.Document.getElementsByName("frmSearch")
For Each btnInput In frm
If btnInput.Value = "frmSearch.submit()" Then
btnInput.submit
Exit For
End If
Next btnInput
Can some one help me on how to click on the button.
As #Tim Williams suggest, this should work document.querySelector("input[value=Search]").
If this still doesn't return the correct input element then the selector can be made more specific according to the DOM tree where the searched input is located, e.g. like this.
' Add reference to Microsoft Internet Controls (SHDocVw)
' Add reference to Microsoft HTML Object Library
Dim inputElement As HTMLInputElement
Set inputElement = doc.querySelector( _
"div[class=main] div[id=inner] table input[type=button][value=Search]")
If Not inputElement Is Nothing Then
inputElement.Click
End If
HTML
<div class="main">
<div id="inner">
<table>
<tbody>
<tr>
<td>
<INPUT onclick="alert('This is the corect one');"
style="WIDTH: 100px"
type=button
value=Search>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<INPUT onclick="alert('No this is not the searched one');"
style="WIDTH: 100px"
type=button
value=Search>
EDIT:
Not sure if I understand your problem correctly.
To select the INPUT element this selector can be used:
Set inputElement = doc.querySelector( _
"form[name=frmSearch] table tbody tr td input[type=button][value=Search]")
To set the value attribute setAttribute() function can be used. To check value attribute getAttribute() function can be used.
If Not inputElement Is Nothing Then
inputElement.setAttribute "value", "some-new-value"
If inputElement.getAttribute("value") = "some-new-value" Then
inputElement.Click
End If
End If

How to Select Radio button inside Fieldset using behat

Can any one please help me out how to select a radio button if it is inside a fieldset??
I can access individual radio button using foreach but when i try to select it or click it its giving some Ajax error.
HTML code is given below
I have tried to select it with radio button's label as well as given in above comment but not able to select it.
<fieldset id="edit-cvs-options" class="form-wrapper">
<legend>
<div class="fieldset-wrapper">
<div class="ios-content" style="display: none;">test</div>
<div class="form-item form-type-radio form-item-use-stored">
<label for="edit-use-stored">
<span>test</span>
<input id="edit-use-stored" class="form-radio" type="radio" name="use_stored" checked="TRUE" value="on" display-title-fix="1"/>
</label>
</div>
<fieldset id="edit-cvs-1" class="form-wrapper" style="display: inline-block;">
<div>
<div class="form-item form-type-radio form-item-use-uploaded">
<label for="edit-use-uploaded">
<span>test</span>
<input id="edit-use-uploaded" class="form-radio" type="radio" name="use_uploaded" display-title-fix="1" value="off"/>
</label>
</div>
</div>
</fieldset>
This is my Behat step definition:
$session = $this->getSession(); // get the mink session
$escapedValue = $session->getSelectorsHandler()->xpathLiteral('use_uploaded');
$radioButton = $session->getPage()->find('named', array('radio', $escapedValue));
$radioButton ->click();