コード例 #1
0
def main(lpk=2114, lipk=8716):
    try:
        data = {}
        base_url = "http://127.0.0.1:5000/lingshare-dev/#"
        wl_path = "lessons/preview/{lpk}/scramble/{lipk}/".format(lpk=lpk,
                                                                  lipk=lipk)
        driver = webdriver.Firefox()
        driver.get(base_url)
        pause(5)
        teacher_login(driver)
        pause(5)
        driver.get(base_url + wl_path)
        pause(5, "loading page")
        start_game(driver)
        pause(5)
        while True:
            play_game(driver)
            pause(2, "Win screen")
            try:
                driver.execute_script("window.scrollTo(0, 1080)")
                nxt_btn = driver.find_element_by_xpath(
                    '//*[contains(text(),"Next sentence")]')
                nxt_btn.click()
                pause(1, "Next sentence!")
            except NoSuchElementException:
                print "Game done!"
                break

    except:
        pass  # make sure the driver is at least returned

    return driver, data
コード例 #2
0
def main():
    base_url = "http://127.0.0.1:5000/lingshare-dev/#"
    driver = webdriver.Firefox()
    driver.get(base_url)
    pause(5, "Loading up page")
    teacher_login(driver)
    pause(5)
    data = create_student(driver)
    pause(5)
    data.extend(update_student(driver))

    return driver, data
コード例 #3
0
def main(wlpk=2545):
    base_url = "http://127.0.0.1:5000/lingshare-dev/#"
    wl_path = "/author/wordlists/{}/edit/".format(wlpk)
    driver = webdriver.Firefox()
    driver.get(base_url)
    pause(5)
    teacher_login(driver)
    pause(5)
    driver.get(base_url+wl_path)
    pause(5)
    create_lesson_from_wl(driver)
    pause(5)
    add_activities(driver)

    return driver
コード例 #4
0
def main():
    base_url = "http://127.0.0.1:5000/lingshare-dev/#"
    driver = webdriver.Firefox()
    driver.get(base_url)
    pause(5, "Loading up page")

    teacher_login(driver)
    pause(5)
    data = create_wl(driver)
    pause(5)
    data.extend(add_words(driver))
    pause(5)
    check_data(driver, data)

    return driver, data
コード例 #5
0
ファイル: vocablab.py プロジェクト: SpeakAgent/sal-test
def main():
    # http://127.0.0.1:5000/lingshare-dev/#/lessons/preview/2103/review/8637
    base_url = "http://127.0.0.1:5000/lingshare-dev/#"
    lpk = '2103'
    lipk = '8788'
    path = "/lessons/preview/{lpk}/vocablab/{lipk}/".format(lpk=lpk, lipk=lipk)
    url = base_url + path

    data = []

    driver = webdriver.Firefox()
    driver.get(base_url)
    pause(5, "Loading up page")
    teacher_login(driver)
    pause(5)
    driver.get(url)
    pause(5)
    play_game(driver)

    return driver, data