jasontj Posted December 12, 2017 Share Posted December 12, 2017 Hi. I have written quite a few scripts to control websites with both Firefox and IE. I'm having to update one now and this checkbox list is giving me issues. Attached is the screenshot, along with the HTML and the code I'm trying. Nothing seems to work. Here is some of the HTML for the checkbox list <input id="frmSearch:scmRegion_focus" name="frmSearch:scmRegion_focus" type="text" readonly="readonly" /></div><div class="ui-helper-hidden"> <input id="frmSearch:scmRegion:0" name="frmSearch:scmRegion" type="checkbox" value="01" data-escaped="true" /> <label for="frmSearch:scmRegion:0">First Circuit</label><input id="frmSearch:scmRegion:1" name="frmSearch:scmRegion" type="checkbox" value="02" data-escaped="true" /> <label for="frmSearch:scmRegion:1">Second Circuit</label><input id="frmSearch:scmRegion:2" name="frmSearch:scmRegion" type="checkbox" value="03" data-escaped="true" /> <label for="frmSearch:scmRegion:2">Third Circuit</label><input id="frmSearch:scmRegion:3" name="frmSearch:scmRegion" type="checkbox" value="04" data-escaped="true" /> <label for="frmSearch:scmRegion:3">Fourth Circuit</label><input id="frmSearch:scmRegion:4" name="frmSearch:scmRegion" type="checkbox" value="05" data-escaped="true" /> Here are a few of the lines I've tired: _FFFormCheckBox("frmSearch:scmRegion", True, 0, "name") _FFFormOptionSelect("frmSearch:scmRegion:0", "id", "02", "value") _IEFormElementOptionSelect ($oSelect, "02", 1, "byValue") _FFFormOptionSelect("frmSearch:scmRegion:1", "id", "02", "value") This one is strange because I'm not sure how to get a handle on it to set the value. Is it a selection box or a checkbox? Nothing seems to work. Any help would be greatly appreciated. Jason Link to comment Share on other sites More sharing options...
jasontj Posted December 12, 2017 Author Share Posted December 12, 2017 Ignore the " _IEFormElementOptionSelect ($oSelect, "02", 1, "byValue") " line. That was leftover from when this was an IE script. Link to comment Share on other sites More sharing options...
Danp2 Posted December 12, 2017 Share Posted December 12, 2017 You have to trigger the click event for the label, not the checkbox. This is easy in Javascript -- $("li[data-item-value='01'] label")[0].click() I haven't translated to Autoit as of yet. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Danp2 Posted December 13, 2017 Share Posted December 13, 2017 Here's the Autoit equivalent -- _FFXPath("//li[@data-item-value='01']/label","",9) _FFCmd("FFau3.xpath.click()") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jasontj Posted December 13, 2017 Author Share Posted December 13, 2017 That worked!!! Thanks so much Dan for your help on this issue. I've learned something new today. Controlling the javascript like that will help me tremendously. Link to comment Share on other sites More sharing options...
Danp2 Posted December 13, 2017 Share Posted December 13, 2017 The trick is to find the correct element and event to trigger. You can use the console in the Developer Tools to find a working solution and then you can convert that to Autoit. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jasontj Posted December 13, 2017 Author Share Posted December 13, 2017 Well, that will make all the difference in the world. Now another change this website made to me was that they now popup results in a window. Is there a way to grab this window, read the page and dismiss it? I know in IE I could grab a handle to it. Link to comment Share on other sites More sharing options...
jasontj Posted December 13, 2017 Author Share Posted December 13, 2017 Actually, I don't need to read this dialog box. If there are records, it pulls up a different page. So, if there is no record, then I can simply open the next page. Thanks again for your help. Link to comment Share on other sites More sharing options...
Danp2 Posted December 13, 2017 Share Posted December 13, 2017 So, you don't need assistance to discard the "No Results" dialog? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
jasontj Posted December 18, 2017 Author Share Posted December 18, 2017 No, I got it all working now. Thanks for the help Danp2. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now