goku200 Posted April 29, 2020 Posted April 29, 2020 I have some code that I've created and am not sure why its not selecting all my checkboxes: <form action="/action_page.php"> <input id="selectAll" type="checkbox"> <input type="checkbox" name="a01" value="Bike"> <label for="vehicle1"> I have a bike</label><br> <input type="checkbox" name="a01" value="Car"> <label for="vehicle2"> I have a car</label><br> <input type="checkbox" name="a01" value="Boat"> <label for="vehicle3"> I have a boat</label><br><br> <input type="submit" value="Submit"> </form> The input id is selectAll selects all the checkboxes, but for some reason its only selecting the checkbox with the id of "selectAll". How do I select the other checkboxes? Here is my code: #include <IE.au3> $url = "http://127.0.0.1/test.html" $oIE = _IECreate ($url, 1) $oForm = _IEFormGetCollection($oIE, 0) $check = _IEFormElementCheckBoxSelect($oForm, 0, "selectAll", 1, "byIndex", 0) Why is it not selecting all the checkboxes? Any help would be appreciated 😃
Danp2 Posted April 30, 2020 Posted April 30, 2020 You have the last parameter, $iFireEvent, set to 0. This prevents the associated events from firing. Try changing it to a 1. Latest Webdriver UDF Release Webdriver Wiki FAQs
goku200 Posted April 30, 2020 Author Posted April 30, 2020 12 minutes ago, Danp2 said: You have the last parameter, $iFireEvent, set to 0. This prevents the associated events from firing. Try changing it to a 1. That worked. What happens if i have a different number set of checkboxes? Some days I may have 2 others I may get 10, etc...
Danp2 Posted April 30, 2020 Posted April 30, 2020 In the context of a "Select All" checkbox, it shouldn't matter. If I misunderstood your post, then please elaborate with an example. Latest Webdriver UDF Release Webdriver Wiki FAQs
goku200 Posted April 30, 2020 Author Posted April 30, 2020 10 hours ago, Danp2 said: In the context of a "Select All" checkbox, it shouldn't matter. If I misunderstood your post, then please elaborate with an example. The issue that I'm having is I'm having to manually write out: $check = _IEFormElementCheckBoxSelect($oForm, 1, "selectAll", 1, "byIndex", 0) with a 1 and then with a 2 and then a 3, etc... #include <IE.au3> $url = "http://127.0.0.1/test.html" $oIE = _IECreate ($url, 1) $oForm = _IEFormGetCollection($oIE, 0) $check = _IEFormElementCheckBoxSelect($oForm, 1, "selectAll", 1, "byIndex", 0) $check = _IEFormElementCheckBoxSelect($oForm, 2, "selectAll", 1, "byIndex", 0) $check = _IEFormElementCheckBoxSelect($oForm, 3, "selectAll", 1, "byIndex", 0) Is there a way to select them all without having to write each line manually based on how many checkboxes I have. Checkboxes can vary daily 😃
Nine Posted April 30, 2020 Posted April 30, 2020 Quote "byIndex" = 0-based index of checkbox you wish to select Try using the 0 index instead of starting to 1. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Danp2 Posted April 30, 2020 Posted April 30, 2020 Sorry, but it's still unclear to me what the issue is. If you manually check the SelectAll checkbox, then I'm assuming that this triggers all of the other checkboxes to be checked. So this line of code would do the same thing -- _IEFormElementCheckBoxSelect($oForm, 0, "selectAll", 1, "byIndex", 1) Note that I changed the value of the last parameter to 1 instead of 0 as you again posted above. Latest Webdriver UDF Release Webdriver Wiki FAQs
goku200 Posted April 30, 2020 Author Posted April 30, 2020 16 minutes ago, Danp2 said: Sorry, but it's still unclear to me what the issue is. If you manually check the SelectAll checkbox, then I'm assuming that this triggers all of the other checkboxes to be checked. So this line of code would do the same thing -- _IEFormElementCheckBoxSelect($oForm, 0, "selectAll", 1, "byIndex", 1) Note that I changed the value of the last parameter to 1 instead of 0 as you again posted above. It looks like its only selecting the checkbox "selectAll" only. When I uncheck it manually and click on the "selectAll" checkbox it selects them all.
Danp2 Posted April 30, 2020 Posted April 30, 2020 Sounds like it isn't triggering some underlying events. Can you share the contents of test.html or direct us to a website exhibiting this same behavior? Latest Webdriver UDF Release Webdriver Wiki FAQs
goku200 Posted April 30, 2020 Author Posted April 30, 2020 14 minutes ago, Danp2 said: Sounds like it isn't triggering some underlying events. Can you share the contents of test.html or direct us to a website exhibiting this same behavior? It's using the jquery library with the following event: function(a, c) { da.actions(this, b, a, c) }
Danp2 Posted April 30, 2020 Posted April 30, 2020 See example I posted here (you may need to adjust to trigger the correct event) -- Latest Webdriver UDF Release Webdriver Wiki FAQs
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