Jump to content

_IEFormElementCheckBoxSelect - I just Can't Understand


Go to solution Solved by Danp2,

Recommended Posts

Not my goal:  Automatically login to a website

My goal: Create a shortcut to this website that launches and checks a particular box every time. 
 
Status: Can't get script to check box.  Box Name = "persist" 
 
Problem: I've spent about 3 hours, and I'm convinced I still don't understand the $s_string parameter and the $s_name parameters. Maybe i've done it right, but there's something in the JS or "onclick/onchange" parameters I don't understand. I'm not sure. 
 
Related Material:  '?do=embed' frameborder='0' data-embedContent>>
erik7426  posted a resolution to this question.   In it, he appears to be trying to "uncheck" the "keep me signed in" box, but I'm not exactly sure because it's not the focus of the article.  Incidentally, upon inspection I found that the checkbox name on that website appears to have been changed to "KMSI". 
 

_IEFormElementCheckBoxSelect ( $o_form, "remMe", "", 0)

Here's the page he was automating: https://login.live.com

Here's the page I want to automate:  https://login.microsoftonline.com
 
I thought my solution would be simple: 

$oIE = _IECreate ("http://login.microsoftonline.com",0,1,1)
$o_form = _IEFormGetObjByName ($oIE, "credentials")

_IEFormElementCheckBoxSelect ( $o_form, "persist", "", 1)

But I'm clearly missing something.

If anyone can inspect the element with chrome and offer any advice, I would be grateful.

 
 
Reason I need this:  
Office 365 doesn't work right if people don't check this box when they login. 
I have 1000 users who cannot be trained to check this box on their own. 

I don't blame them, it makes them login every 2 hours no matter what. 
We keep getting calls that say "It's not working", we have to log them out and back in, and check the box. 
See here:  http://newsignature.com/blog/2013/04/24/open-with-explorer-errors-in-sharepoint-2010/#.UytT-fldXTc

 

Link to comment
Share on other sites

 

The checkbox isn't contained within the form. Therefore, _IEFormElementCheckBoxSelect won't work. Try this:

#include <ie.au3>

$oIE = _IECreate ("http://login.microsoftonline.com",0,1,1)

$oChk = _IEGetObjByName( $oIE, "persist")
_IEAction($oChk, 'click')

 

Yes!  Awesome, Thank You, Thank you.  That was my problem.  The box now is visibly getting checked with the method above.

On to next challenge... actually making it work.

Once logged in, it's behaving as though the box was not checked.   Could this be related to the "OnClick" or "OnChange" events ?  These events seem to be mentioned in the _IEFormElementCheckBoxSelect  function, but not in the _IEAction function.  Since it's not in a form, I'm guessing we can't use the checkboxselect method.

Here was my test to determine if the checkbox was functioning properly when launched via script:

1. Launch page via script, enter credentials, login and test "Open with Explorer feature" (Fails)

2. Launch page via script, enter credentials, uncheckbox and recheckbox manually, login and test "Open with Explorer feature" (Success)

Any alternative ways to emulate the checking of this box which might trigger the necessary events? 

Link to comment
Share on other sites

#include <ie.au3>

$oIE = _IECreate ("http://login.microsoftonline.com",0,1,1)

$oChk = _IEGetObjByName( $oIE, "persist")

$oChk.checked = True
$oChk.fireEvent("onChange")
$oChk.fireEvent("OnClick")

DanP, thank you once again. 

Your original code was actually sufficient, I had a piece of code out of order and now it's working.

I really appreciate people like you who analyze peoples problems, and post real code suggestions.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...