예제 #1
0
파일: commons.py 프로젝트: Prodject/arjuna
def login(automator,at_home=False):
    if not at_home:
        go_to_wp_home(automator)

    user, pwd = automator.config.get_user_option_value("wp.users.admin").split_as_str_list()

    # Login
    automator.element(With.id("user_login")).set_text(user)
    automator.element(With.id("user_pass")).set_text(pwd)
    automator.element(With.id("wp-submit")).click()

    automator.element(With.class_name("welcome-view-site")).wait_until_visible()
예제 #2
0
'''
3. (Especially for custom select controls) - Click the drop down control and then click the option. 
'''

from commons import *
from arjuna.tpi.guiauto.helpers import With, GuiActionConfig

init_arjuna()

automator = launch_automator()

url = automator.config.get_user_option_value("narada.ex.dropdown.url").as_str()
automator.browser.go_to_url(url)

conf = GuiActionConfig.builder().check_type(False).check_post_state(
    False).build()

dropdown = automator.dropdown(
    With.id("DropDown"),
    option_container_locators=With.class_name("dropdown"),
    option_locators=With.class_name("dropdown-item"))
dropdown.configure(conf)
dropdown.select_index(2)

# automator.quit()
from commons import *
from arjuna.tpi.guiauto.helpers import With, Screen

init_arjuna()

automator = launch_automator()
go_to_wp_home(automator)

user, pwd = automator.config.get_user_option_value(
    "wp.users.admin").split_as_str_list()

# Login
automator.element(With.id("user_login")).set_text(user)
automator.element(With.id("user_pass")).set_text(pwd)
automator.element(With.id("wp-submit")).click()

automator.element(With.class_name("welcome-view-site")).wait_until_visible()

# Logout
url = automator.config.get_user_option_value("wp.logout.url").as_str()
automator.browser.go_to_url(url)

automator.element(With.link_ptext("log out")).click()
message = automator.element(With.ptext("logged out")).wait_until_visible()

automator.quit()
예제 #4
0
automator = launch_automator()

url = automator.config.get_user_option_value("narada.ex.radio.url").as_str()
automator.browser.go_to_url(url)

radios = automator.radio_group(With.name("Traditional"))
radios.select_index(1)

# Tag mix up
radios = automator.radio_group(With.name("Prob1"))
radios.select_index(1)

# Type mix up
radios = automator.radio_group(With.name("Prob2"))
radios.select_index(1)

# Group mix up
radios = automator.radio_group(With.class_name("Prob3"))
radios.select_index(1)

# state check off
conf = GuiActionConfig.builder().check_pre_state(False).build()
radios = automator.element(With.name("Traditional").configure(config))
radios.select_index(1)

# tag mix up, state check off
conf = GuiActionConfig.builder().check_pre_state(False).build()
radios = automator.element(With.name("Prob1").configure(config))
radios.select_index(1)

automator.quit()
예제 #5
0
init_arjuna()

automator = launch_automator()
go_to_wp_home(automator)

# The following code is for user name field.
# Html of user name: <input type="text" name="log" id="user_login" class="input" value="" size="20">
element = automator.element(With.id("user_login"))
element.identify()
print(element.source.content.root)

element = automator.element(With.name("log"))
element.identify()
print(element.source.content.root)

element = automator.element(With.class_name("input"))
element.identify()
print(element.source.content.root)

element = automator.element(With.tag_name("input"))
element.identify()
print(element.source.content.root)

# The following options are for
# Html of link: <a href="http://192.168.56.103/wp-login.php?action=lostpassword" title="Password Lost and Found">Lost your password?</a>
element = automator.element(With.link_text("Lost your password?"))
element.identify()
print(element.source.content.root)

element = automator.element(With.link_ptext("password"))
element.identify()