Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Website Error Message Box - Click Ok
#1
Greetings Friends,

I need to have the 'ok' button clicked for an error message that pops up from a website.
Kindly advise.

Macro temp
Code:
Copy      Help
;City
Htm e12=htm("INPUT" "ctl00_cphMain_txtCity" "" w "0" 39 0x121 3)
e12.SetText(place)

mes- "Go Ahead?" "Go Ahead?" "OC"

;Click Register Sale
Htm e13=htm("INPUT" "ctl00_cphMain_btnRegister" "" w "0" 50 0x121 3)
e13.Click

;Click 'OK' on email error message
int w3=wait(31 win("Message from webpage" "#32770"))
Best Regards,
Philip
#2
On the QuickMacros top toolbar choose: Windows, controls > HTML element actions:
Then, follow the wizard, drag the aim to the "OK" button and choose the "Click" action.

The code should look a little like this:

Function teste
Code:
Copy      Help
int w=wait(3 WV win("(...)" "IEFrame"))
Htm e=htm("OK" " " "" w "0" 144 0x21 3)
e.Click

Where:
int w = is the window variable
Htm e = is the HTML element variable
e.click = is the click action on the HTML element
#3
Try to replace
e13.Click
to
e13.ClickAsync
#4
Tried that now.

Aim does not produce a result.

Rather I tried the below too (via Windows action) and I get the window handle.

Don't know how to go from here.
How do I click the ok button?

int w3=win("Message from webpage" "#32770")
act id(1 w3) ;;push button 'OK'
Best Regards,
Philip
#5
replace 'act' with 'but'
#6
I am still unable to get the child message box to be clicked...
Kindly take a look at the JPEG file.

Code used as below:

Macro RO Sales gDN
Code:
Copy      Help
,;Click 'OK' on email error message
,int w11=wait(10 WV win("Message from webpage" "#32770"))
,Acc a.Find(w11 "PUSHBUTTON" "OK" "class=Button[]id=1" 0x1035 10)
,a.Mouse(1)


Attached Files Image(s)
   
Best Regards,
Philip
#7
What exactly fails?
The wait line waits 10 s then error?
The Acc line waits 10 s then error?
Error at a.Mouse?
a.Mouse is executed but nothing happens?
...
#8
Just waits indefinitely when the message box appears
Whereas, when I test using the dialog box, it works...
Best Regards,
Philip
#9
This code cannot wait more than 20 s. Are you sure it is executed? Maybe waits previous statement. For example if it is like e.Click, it waits until message box closed.
#10
Nope that's not the case.
Here is part of the entire code before and after the issue code:

Macro RO Sales gDN
Code:
Copy      Help
,MES m
,m.style="OC"
,m.x=100
,m.y=500
,m.timeout=800
,m.default='C'

,int t=mes("Go Ahead?" "Go Ahead?" m)
,
,;Click Register Sale
,Htm e13=htm("INPUT" "ctl00_cphMain_btnRegister" "" w "0" 50 0x121 10)
,e13.Click
,
,;wait 2
,;Click 'OK' on email error message
,int w11=wait(10 WV win("Message from webpage" "#32770"))
,Acc a.Find(w11 "PUSHBUTTON" "OK" "class=Button[]id=1" 0x1035 10)
,a.Mouse(1)
,err+
,,mes F"After email error message {_error.line}"
,
Best Regards,
Philip
#11
e13.Click waits, replace to e13.ClickAsync
#12
Perfecto...works like a breeze.
So, it's the click code prior to the issue code that needed the amending.

Thanks Gintaras.
Best Regards,
Philip


Forum Jump:


Users browsing this thread: 4 Guest(s)