onlineth

_IE Action not working

10 posts in this topic

#1 ·  Posted (edited)

Hello, I believe I have come across a bug in the _IE library. I am trying to make a script that will automatically fill's in data for a restore script for a WP site. It's called Importbuddy by IThemes and it is one of the best, if not the best, backup restore plugins for WordPress. The problem that I am having is once it is on the first step of the script, filling in the password and clicking next, it redirects me to the index.php file and when I keep trying to return to the importbuddy.php file, it keeps redirecting back to the index file. Here is the code I am using, 

_$o = _IECreate() 
_IENavigate($o, [url of ImportBuddy]) 
_IELoadWait($o, 2000)
$step0 = _IEGetObjByName($o, "password");Password feild
_IEFormElementSetValue($step0, "pass");Password of Importbuddy
$Step0submit = _IEGetObjByName($o, "submit") 
_IEAction($Step0submit, "click") 
_IELoadWait($o, 2000)
;Goes to index.html, not the next step of the importbuddy

Here is a link to the importbuddy.php file,   http://bit.ly/1H9YZNb

Please only use this file for testing, it is part of a commercial product by IThemes 

To keep this simple, just install a program like XAMPP to view the file. Also, the password is "pass"

Does anyone have any ideas why this isn't working? 

As always, Thanks for your help 

Thomas 

Edited by onlineth

online.png?theme=dark profile for Tom on Stack Exchange, a network of free, community-driven Q&A sites 

scientia potentia est

Share this post


Link to post
Share on other sites



ok, I think I am going to take a different route on this. First I tried using the _IEFormSubmit but I keep getting an error of "2 ($_IEStatus_COMError) - COM Error in Object reference"

$o = _IECreate()
_IENavigate($o, "http://test.onlineth.x10host.com/importbuddy.php")
_IELoadWait($o, 2000)
$step0 = _IEGetObjByName($o, "password")
$form = _IEFormGetCollection($o, 0)
_IEFormElementSetValue($step0, "pass")
_IEFormSubmit($form)

So then I tried using the IE extended library but I can't get that to work either. Here is what I have for that,

$o = _IECreate()
_IENavigate($o, "http://test.onlineth.x10host.com/importbuddy.php")
_IELoadWait($o, 2000)
$step0 = _IEGetObjByName($o, "password")
$form = _IEFormGetCollection($o, 0)
_IEFormElementSetValue($step0, "pass")
$step0name = _IEGetObjByName($o, "submit")
_IEEx_JSMouseEventObjByName($o, $step0name, "mouseclick")
_IELoadWait($o, 2000)
I keep getting a "7 = No Match" error for that. I am running IE11

Also, the password for the http://test.onlineth.x10host.com/importbuddy.php is not "pass" but an extremely long string so no one will be albe to install anything malicious, it's just there so you can click on the button. If you click on it you should see this message, "Invalid password. Please enter the password you provided within BackupBuddy Settings. Attempt #."

Again, thanks for your help :)


online.png?theme=dark profile for Tom on Stack Exchange, a network of free, community-driven Q&A sites 

scientia potentia est

Share this post


Link to post
Share on other sites

Appears to work if you drop _IEFormSubmit and use _IEAction instead:

;_IEFormSubmit($form)
$btnSubmit = _IEGetObjByName($o, "submit")
_IEAction($btnSubmit, 'click')

Share this post


Link to post
Share on other sites

 

Appears to work if you drop _IEFormSubmit and use _IEAction instead:

;_IEFormSubmit($form)
$btnSubmit = _IEGetObjByName($o, "submit")
_IEAction($btnSubmit, 'click')

Yes, but the issue is when I use _IEAction and "click", it redirects me to the index.html page (when I use the correct password) and when I try to navigate back to the /importbuddy.php it keeps redirecting back to the index.html file. If you can, put  the importbuddy.php file,  http://bit.ly/1H9YZNb, on a server and when you use the correct password(pass), you will see what I'm talking about. 


online.png?theme=dark profile for Tom on Stack Exchange, a network of free, community-driven Q&A sites 

scientia potentia est

Share this post


Link to post
Share on other sites

Sounds like a configuration issue.  What happens if you manually click the button? 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Sounds like a configuration issue.  What happens if you manually click the button? 

It goes to the next step without any problems

EDIT

That's why I was exploring the other ways to see if that would work

Edited by onlineth

online.png?theme=dark profile for Tom on Stack Exchange, a network of free, community-driven Q&A sites 

scientia potentia est

Share this post


Link to post
Share on other sites

It goes to the next step without any problems

 

Not in my testing. Even if I manually enter the password, it initially displays the index. If I then go back and refresh the php page, it goes to the desired web page.

Share this post


Link to post
Share on other sites

Not in my testing. Even if I manually enter the password, it initially displays the index. If I then go back and refresh the php page, it goes to the desired web page.

Hmm, again, I am using this script,

$o = _IECreate()
_IENavigate($o, "http://test.onlineth.x10host.com/importbuddy.php")
_IELoadWait($o, 2000)
$step0 = _IEGetObjByName($o, "password")
$form = _IEFormGetCollection($o, 0)
_IEFormElementSetValue($step0, "pass")
$step0name = _IEGetObjByName($o, "submit")
;_IEEx_JSMouseEventObjByName($o, $step0name, "mouseclick")
$btnSubmit = _IEGetObjByName($o, "submit")
_IEAction($btnSubmit, 'click')
_IELoadWait($o, 2000)
_IENavigate($o, "http://test.onlineth.x10host.com/importbuddy.php")

However when I use the _IENavigate it does nothing. Also, I added _IEQuit which also does nothing. What version of IE are you running? I'm only asking this because I've been reading about alternatives and it seems that the update from IE10 to 11 seems to have caused much conflict (I'm running IE11). Also, do you know why the other scripts I made don't work?

Thanks for help on this:)


online.png?theme=dark profile for Tom on Stack Exchange, a network of free, community-driven Q&A sites 

scientia potentia est

Share this post


Link to post
Share on other sites

Sounds like you are running into the issue where an update from MS broke the IE scripting. Search the forum and you'll find the details and how to resolve it.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Does anyone know why the other scripts I have created don't work?

$o = _IECreate()
_IENavigate($o, "http://test.onlineth.x10host.com/importbuddy.php")
_IELoadWait($o, 2000)
$step0 = _IEGetObjByName($o, "password")
$form = _IEFormGetCollection($o, 0)
_IEFormElementSetValue($step0, "pass")
_IEFormSubmit($form) 
$o = _IECreate()
_IENavigate($o, "http://test.onlineth.x10host.com/importbuddy.php")
_IELoadWait($o, 2000)
$step0 = _IEGetObjByName($o, "password")
$form = _IEFormGetCollection($o, 0)
_IEFormElementSetValue($step0, "pass")
$step0name = _IEGetObjByName($o, "submit")
_IEEx_JSMouseEventObjByName($o, $step0name, "mouseclick")
_IELoadWait($o, 2000)
Edited by onlineth

online.png?theme=dark profile for Tom on Stack Exchange, a network of free, community-driven Q&A sites 

scientia potentia est

Share this post


Link to post
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

  • Similar Content

    • Spask
      By Spask
      Hi, I'm trying to find a text value inside of a html.
      This is what the line looks like normally:
      <p id="line1" class> <span class="bot">TEXT HERE</span> </p> The text then changes to a non breaking space:
      <p id="line1" class> <span class="bot">&nbsp;</span> </p> And then it changes back to normal text but it's different every time.
      Can I code this so that it grabs the text every time it changes and has a variable that represents it?
      I currently have this inside of my loop:
      $span = .document.getElementsByTagName("span") For $text In $span If $text.value = "&nbsp;" Then Sleep(50) MsgBox(0,0,0) ;messagebox to test if it can be found, but I don't know how to grab the text EndIf Next The problem is that there are many other lines in the html that have the same span but are called "line3", "line5", etc and the one I need is from "line1".
      I will appreciate if anyone can help with this!
    • electrons
      By electrons
      hi  , hope  you all doing well 
       cant find any elements on the page ?  and the right click mouse dont work too?
      iam trying with more than method , i need help please!!
       

    • ur
      By ur
      I have kept below line to wait for IE to load the site completely and continue.
      _IELoadWait($oIE)
       
      But, the code is continuing without waiting for it and I my execution is failing as the elements are not loaded completely.

       
      Any suggestions for alternate code to wait for the browser to load completely?
       
    • ur
      By ur
      We can select elements in IE using their IDs as below.
      Local $oDiv = _IEGetObjById($oIE, "x-auto-16-input") But to one button in the webpage, there is no ID to it.
      In selenium we have option to select this element using the CssSelector and clicked the button using below code in c# selenium.
      driver.FindElement(By.CssSelector("button.x-btn-text")).Click(); What is the alternative for this in AUtoIT?
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning everyone
      I worked a bit on a little project of mine, and I managed to do what I was trying to do, or, automate a quiz in AutoIt.
      Now, everything works fine but, in order to achieve what I'm trying to achive, I'd like to make this script run faster.
      I'll attach a portion of the code in order to let you understand what my script does.
      $objIE_h1 = _IETagNameGetCollection($objIE, "h1") ; Take the text of the answer If @error Then ConsoleWrite("Errore durante la lettura degli h1 nella pagina. - Errore: " & @error & @CRLF) Else For $objElement In $objIE_h1 $strInnerText = $objElement.innerText Next Select Case StringInStr($strInnerText, "QUESTION") ; Here is the question ; PS4 PRO $objSpans = _IETagNameGetCollection($objIE, "span") ; Answers are stored here For $objElement In $objSpans If $i >= 4 Then $strAnswer = $objElement.innerText ; Take the text of the answer n° 0, 1, 2, 3 If StringInStr($strAnswer, "CORRECT ANSWER") Then ; If I match the correct answer, then, I have to click on the input with answer id = answer_i $j = $i - 4 $objInput = _IEGetObjById($objIE, "answer_" & $j) If @error Then ConsoleWrite("Errore durante la lettura della risposta #" & $i & " - Errore: " & @error & @CRLF) Else _IEAction($objInput, "click") If @error Then ConsoleWrite("Errore durante il click sull'elemento. - Errore: " & @error) Else ConsoleWrite($j & ") Risposta: " & $strAnswer & @CRLF) ExitLoop EndIf EndIf EndIf $i+=1 Else $i+=1 EndIf Next $i = 0 $j = 0 This is what my script does.
      Questions are 20, in which I have 15 multiple choice question, 2 images ( on which I use _IEImgClick() ), and 3 text inputs ( a simple send with the text I have to enter ).
      How can I make all of these, faster?
      If I reach this goal, I've probably done one of my best goals in life, and I'd like to share my happiness with you, giving a huge donation to this fantastic community!
      Thanks for your help