Jump to content
Sign in to follow this  
Wolfiesaxah

Check if iframe or button exist exists

Recommended Posts

Wolfiesaxah

I'm trying to get the best script to identify if the next page after the `Continue` button is a success page or failed page.

The website I'm trying to send a form into has a form page wherein after clicking `Continue` it would then display the next web page which either has the button `Submit Application` or the text `This user already submitted this application form!`. One thing I noticed is that the website actually uses series of iframes (`FormFrame1` to `FormFrame5`), after filling info in `FormFrame1` and clicking next it (I believe) hides the `FormFrame1` and shows `FormFrame2` and so on until `FormFrame5` where the `Submit Applicationbutton usually is found. Is there a script to identify if the `Submit Applicationbutton is visible or if the text/string `This user already submitted this application form!` is visible instead? I'm trying to use that as a basis if the application verification passed (when it shows the  `Submit Application` button then it means it passed.

 

I tried this below and it seem to work sometimes. It can see if `FormFrame5` is visible which contains  `Submit Application` button and would mean the verification was successful but it does not seem to execute the `.scrollIntoView()`, `.getElementById("CheckboxAgree").click`, and `.getElementById("SubmitForm").click` anymore (it execute these properly until I added the `For $FrameIndex = 0 to $oIE.document.frames.length-1` script for checking which iframe is visible. Can you help me? Or at least tell me why the codes inside the If statement below doesn't get executed? Funny thing is `MsgBox(0,"","Completed!",0)` seem to running properly.

Local $FoundGood = 0
                     For $FrameIndex = 0 to $oIE.document.frames.length-1
                        If $oIE.document.frames($FrameIndex).name = "FormFrame5" then
                           $oIE.document.frames($FrameIndex).document.getElementById("CheckboxAgree").scrollIntoView()
                           $oIE.document.frames($FrameIndex).document.getElementById("CheckboxAgree").click
                           $oIE.document.frames($FrameIndex).document.getElementById("SubmitForm").click
                           $FoundGood = 1
                           MsgBox(0,"","Completed!",0)
                           Sleep(10000)
                        EndIf
                     Next
                     if $FoundGood = 0 then MsgBox(0,"","Confirmation NOT found!",0)

By the way, I already tried the isObject script but that line gives an error (probably when it checks and the `FormFrame5` is not even visible yet)

 

Edited by Wolfiesaxah

Share this post


Link to post
Share on other sites
Wolfiesaxah

Just curious... what's the website?

​I can't disclose that as I need to protect any info regarding my client's strategies and techniques but it is a website for bidding items and products and I am creating something that automatically send application for each of the items in the list that the client picked.

Share this post


Link to post
Share on other sites
Wolfiesaxah

Add an error handler.

​Thanks JohnOne, but what will be the purpose though? error handlers will just pop-up an error in a nice way but wouldn't solve the issue I think, I could be wrong as you are the expert so please share more info on how error handler will solve my problem? :) Thanks for always helping us

Share this post


Link to post
Share on other sites
JohnOne

You try to get the object in a loop, if it's not there, error handler fires, not an outright error.

Do that in a loop in tandem with IsObject and you can effectively wait until it does exist or for a certain amount of time until you deem it not to be there at all.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Danp2

​I can't disclose that as I need to protect any info regarding my client's strategies and techniques but it is a website for bidding items and products and I am creating something that automatically send application for each of the items in the list that the client picked.

​I asked for the site URL, not your client's strategies and techniques. Have you read the forum rules and are you sure that your automation attempts does run afoul of them? Same for the web site's TOS.

Share this post


Link to post
Share on other sites
Wolfiesaxah

Yes I have and I'm pretty sure none of my automation violates any of that. I'm not creating anything that floods a website, bots a game, or anything else that should not be promoted or assisted here. There is a website wherein items and batches of products are being sold and my client buys them to sell them in his vicinity, simple as that.

Do you actually have a solution or suggestion for this? Sad to know only 2 persons responded and 1 is a police but still glad that JohnOne's suggestion gave me an idea. 

Share this post


Link to post
Share on other sites
Danp2

Sad to know only 2 persons responded and 1 is a police but still glad that JohnOne's suggestion gave me an idea. 

​I'm definitely not the police... just a concerned citizen. :D

I'm trying to use that as a basis if the application verification passed (when it shows the  `Submit Application` button then it means it passed.

$oIE.document.frames($FrameIndex).document.getElementById("CheckboxAgree").scrollIntoView()
$oIE.document.frames($FrameIndex).document.getElementById("CheckboxAgree").click

When I read stuff like the above, it raises some concerns. 

Do you actually have a solution or suggestion for this? 

Have you considered using _IEFrameGetCollection? Without the real URL or another site with the same scenario, I don't see how I would be able to assist you any further.

Dan

Share this post


Link to post
Share on other sites
Wolfiesaxah
 

​I'm definitely not the police... just a concerned citizen. :D

When I read stuff like the above, it raises some concerns. 

Have you considered using _IEFrameGetCollection? Without the real URL or another site with the same scenario, I don't see how I would be able to assist you any further.

Dan

​Understood, I am actually trying John's idea and I couldn't use most of the UDF as I often get errors in one of them like missing "EndFunc" detected in IE.au3 so I started using the UDFs as a guide while I do the function separately. Dunno what made you concerned about those 2 lines of codes you quoted?:)

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  

×