Jump to content

IE seems not to be attaching new page


Recommended Posts

I Posted like a week or so ago about a code that was jumping commands in a very strange way on server.

So I changed the machine/environment to a more vanilla W10.

I Tested and I could swear the first time it worked like a charm up to the point I was expecting. But now I guess when transitioning between my login page and the main page I want to download stuff from  the _IEAttach command isn't working.

I tried leaving the page logged in and commenting everything to do with the login page and it worked normally so the only problem I could see is that the thing is not Attached to the page and so doesn't find the elements on it that I need to fill.

$loginButton = _IEGetObjById($oIE, "btnLogin")
Sleep(100)
_IEAction($loginButton, "click")

_IELoadWait($oIE)

_IEAttach(_IEPropertyGet($oIE, "locationurl"),"url")


Sleep(10000)

$dtfinal = _IEGetObjById($oIE, "txtDtFim")
$datahoje = StringSplit(_NowDate(),"/")
Sleep(100)
_IEAction($dtfinal, "focus")

this is the snippet of the region of code where I log In, attach and start searching for elements on the new page.

I must also say that it runs normally on my other local machines (including the one I'm accessing the VM I want to leave the code to run on), only difference between then is that the VM seems to be 1 win att. forward (VM on W10 2004 vs other ones on W10 1909) which i want to believe is really not the problem.

Can someone offer some advice on this?

Link to comment
Share on other sites

@Danp2 My objective is that after loading the new page the script would reattach to the page just loaded.

So say I was at http://site.url/login and after login in I go to http://site.url/filedownload if i try to select something on this new page i need to reattach or else AutoIT wont "read" this new page.

I Also saw _IEAttach as a function that just change the variables without needing the return so i didn't think i need to put it to a variable.

So I just write it like that so after my IE have loaded the new page it gets the url (with _IEPropertyGet) and _IEAttach attaches it based on this url.

It seems to work every time i tried it before, and as I said this code runs smoothly everywhere else except for the one VM I need it to work on.

 

EDIT: I tried putting the attach to the $oIE variable and still it doesn't work.

Edited by GTheAutomator
add information
Link to comment
Share on other sites

Your logic is flawed. If a reattach is required, then you would need to assign the result from _IEAttach to a variable. Otherwise, you are still using the "old" variable that potentially points to a different IE instance.

Have you reviewed the contents of the Scite output panel? My guess is that it is showing some errors that will help you determine where your script is failing.

Link to comment
Share on other sites

@Danp2 As I Said it says it can't find the elements in the page:

--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (txtDtFim)
--> IE.au3 T3.0-2 Error from function _IEAction(focus), $_IESTATUS_InvalidDataType

The elements are there in the page for sure, but autoit seems to not find them, that's what leads me to believe that is something wrong with it interacting with that page. That and the fact that when "jumping" the previous login related part of my flow it works normally leads me to believe it's something in that page transition (as in reattaching the page) is the problem.

And as I also commented it seems to be something that just happens in this machine, I tested in  4 others and it works normally for this.

 

 

 

Edited by GTheAutomator
Link to comment
Share on other sites

@Danp2 yes, I did some searching but could not find something that quite helped me.

Also, I did as @Nine Suggested and put up some "prints for the error flag, seems like attach itself is not changing the error flag value but the search is. This come out

All the flags above relate to one of the commands (pressing the login button, loadwait, attach and the getobjectbyid.

LOGIN   0   PG LOAD 0   ATTACH  0   --> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (txtDtFim)
TXT FIM 7

I also did as you said and assigned the output of the attach function to my IE variable ($oIE).

But nothing yet seem to have worked.

Link to comment
Share on other sites

You could try to loop thru all the tags using _IETagNameGetCollection.  Just print the id of each ones.  See if you can find it with this method.  Maybe increase the sleep time before.

Link to comment
Share on other sites

  • 2 weeks later...

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...