Example #1
0
automator.execute_javascript("window.open('https://rahulverma.net')")
automator.execute_javascript("window.open('https://google.com')")
automator.close_all_child_windows()
print(main_win.title)

automator.execute_javascript("window.open('https://rahulverma.net')")
automator.execute_javascript("window.open('https://google.com')")

dwin = automator.child_window(With.window_title("Google"))
dwin.focus()
dwin.title
dwin.close()

automator.execute_javascript("window.open('https://rahulverma.net')")
automator.execute_javascript("window.open('https://google.com')")

dwin = automator.child_window(With.window_ptitle("gle"))
dwin.focus()
dwin.title
dwin.close()

automator.execute_javascript("window.open('https://rahulverma.net')")
automator.execute_javascript("window.open('https://google.com')")

dwin = automator.child_window(With.content_locator(
    With.value("Google Search")))
dwin.focus()
dwin.title
dwin.close()

logout(automator)
element = automator.element(With.text("Lost your password?"))
element.identify()
print(element.source.content.root)

# Based on partial text
element = automator.element(With.ptext("Lost"))
element.identify()
print(element.source.content.root)

# Based on Title
element = automator.element(With.title("Password Lost and Found"))
element.identify()
print(element.source.content.root)

# Based on Value
element = automator.element(With.value("Log In"))
element.identify()
print(element.source.content.root)

# Based on any attribute e.g. for
element = automator.element(With.attr_value("[for][user_login]"))
element.identify()
print(element.source.content.root)

# Based on partial content of an attribute
element = automator.element(With.attr_pvalue("[for][_login]"))
element.identify()
print(element.source.content.root)

# Based on element type
element = automator.element(With.type("password"))