Browser Authentication Window and DEDENT error

Asked by Rudiger Wolf

I am typing to open up firefox and access a web page that required me to login via windows authentication.

I can't type in the username and password when the authentication dialog come up.

I seem to have a problem making sure that the popup authentication window get focus for the type command.

Any suggestions?

[error] Stopped
[error] An error occurs at line 8
[error] Error message: SyntaxError: ("mismatched input '' expecting DEDENT", ('C:\\Users\\rwolf\\AppData\\Local\\Temp\\sikuli-tmp6848519104168900170.py', 8, 5, '\t type("domain\\\\username" + Key.TAB)\n'))

def myHandler(event):
        # event: can be any variable name, it references the SikuliEvent object
        print("event happened")
        event.region.highlight() # highlight all changes
        sleep(1)
        type(PICTURE OF USER NAME CAPTION ,"a",KEY_CTRL)
  #type("a", KEY_CTRL) # Select full UserName field
     type("domain\\username" + Key.TAB)

#Setup the handler to deal with browser authentication window
onAppear(PICTURE OF AUTHENTICAION REQUIRED WINDOW , myHandler) # or any other onEvent()

myApp = App("Firefox")
if not myApp.window(): # no window(0) - Firefox not open
        App.open("c:\\Program Files\\Mozilla Firefox\\Firefox.exe")
        wait(4)
myApp.focus()
wait(5)

type("l", KEY_CTRL) # switch to address field
type("https://mysite.com"+Key.ENTER)
observe(10) #Observe to 10 sec

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

This is only a syntax error ;-)
The last line in the def is on the wrong indentation level.

do not mix tab's and blanks in one script.

recommendation: use tab to indent and shift-tab/backspace to dedent never use blank/space

(the next version will have more support for that :-)

Revision history for this message
RaiMan (raimund-hocke) said :
#2

one more comment: your type will not work because of the backslash

use paste to write text to fields: look faq 933

Revision history for this message
Rudiger Wolf (rudiger-wolf) said :
#3

Thanks RaiMan, that solved my question.