Sign in to follow this  
Followers 0
Kamakazy

IE & JS containers.

4 posts in this topic

Hi All.

I am baffled by n piece of scripting....

The background is:

I am Automating an internal website in IE. Everything was going great up to the point where I needed to start and refactor some code.

The way the system is designed is that options are selected but all interactions (warnings, errors, results,etc) are generated by JS.

The previous way I dealt with this was to simply add "Sleep(5000)" in every now and then. But in my experiance, this is a dangerous way as not all returns take the same time.

Is there a way that I can get the script to wait for the process to respond (_IELoadWait is not working) before continueing..

PS. I have also tried reading the body HTML and asserting if certain text is present but this also failed as none of the JS is visible in the HTML of the source...

I'm stummped on this one.

If you need any other info, ill gladly give it.

Thanx guys.

Kama

Share this post


Link to post
Share on other sites



Assuming you know what you're talking about since this is internal, btw, Having internal html/JS you are miles above the others, something like the below should be simple for you.

Why not just use something like ...parentWindow().execScript or ...parentWindow().eval() to accomplish what you want?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Mmmm, Have not thought about that.... My mind was stuck in IE.

Will give it a whirl.. Thanx man !

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Update:

The trick did not work but I have found a small workaround.

Instead of trying to assert if something exists, I rather looked for something that does NOT exist. this little error check did the trick in bypassing the JS error.

CODE:
$oIE already declared
$oForm already declared
$oFormField = _IEFormElementGetObjByName($0Form, "Field to be tested")
_IEFormElementSetValue($oFormField, "value/###")

If _IEFormElementGetValue ($oFormField) = "" Then    ;    At this point I am checking the field to see if it has data or not
_FileWriteLog($log, "Your error Msg ")    ;    If no data was detected in the field, I log it and stop the script from procedding.
Exit 0
Else
_FileWriteLog($log, "Your success Msg")    ;    If data was found, I also log it and simply continue on.
EndIf

Note, for security reasons, all variables and values have been changed....

Hope this works for you!

And critics are welcome, good or bad.... thats how I learn.

Kama

Edited by Kamakazy

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
Sign in to follow this  
Followers 0