コード例 #1
0
    def paper_wdgf(self, driver):
        try:
            driver.find_element_by_id(
                'com.example.examda:id/question_pop_submit_btn').click()
            amount = answer().amount(driver)
            amount = int(amount)
            print "问答评估分sssssssssssssss s%" + str(amount)
            for amount in range(amount + 1):
                try:
                    time.sleep(2)
                    driver.find_element_by_id(
                        'com.example.examda:id/nq04_usergradeselfet'
                    ).send_keys('1')
                    driver.find_element_by_id(
                        'com.example.examda:id/nq04_savegradebtn').click()
                    time.sleep(2)
                    swipLeft(driver=driver, t=300)
                except:
                    pass
            driver.find_element_by_id(
                'com.example.examda:id/nq03_choice_answerll').click()  #提交试卷
        except:
            print "没有找到元素"
        time.sleep(2)
        self.check_answer(driver)  #

        if __name__ == '__main__':
            unittest.main()
コード例 #2
0
class TestDict(unittest.TestCase):

    def test_init(self):
        print('test_init')

    if __name__ == '__main__':
        unittest.main()
コード例 #3
0
ファイル: home_class.py プロジェクト: iori422/wx_scrpit
    def home_login(self, driver):  #登录操作
        try:
            driver.find_element_by_id("com.example.examda:id/tvMy").click()
            driver.find_element_by_id(
                'com.example.examda:id/no09_user_jifen_ll')  #已登录
            driver.find_element_by_id(
                'com.example.examda:id/ivQuestion').click()
            print '已登录'
        except:
            driver.find_element_by_id("com.example.examda:id/tvMy").click()
            driver.find_element_by_id(
                'com.example.examda:id/no09_user_no_login').click()  # 我的注册
            t = login_pag()
            t.login(driver=driver)
            driver.find_element_by_id(
                'com.example.examda:id/no01_loginbut').click()
            print '未登录'

        if __name__ == '__main__':
            unittest.main()
コード例 #4
0
class TestGetContent(TestCase):
    def test_getContent(self):
        print getContent([(
            1,
            'http://www.onetonline.org/link/result/11-1021.00?c=tk&n_tk=0&e_tk=1&c_tk=50&s_tk=IM&n_tt=20&s_tt=s&e_tt=L&e_tt=C&n_kn=10&c_kn=50&s_kn=IM&n_sk=10&c_sk=50&s_sk=IM&n_ab=10&c_ab=50&s_ab=IM&n_wa=10&c_wa=50&s_wa=IM&n_dw=10&a_iw=g&a_iw=i&a_iw=d&a_iw=t&n_cx=10&c_cx=50&c_in=50&n_ws=10&c_ws=50&c_wv=50&n_wn=10&c_wn=50&n_cw=10&s_cw=CIP&g=Go'
        )])

    def test_getContent2(self):
        print getContent([(
            2,
            'http://www.onetonline.org/link/result/11-1031.00?c=ta&n_ta=0&n_tt=20&s_tt=s&e_tt=L&e_tt=C&n_kn=10&c_kn=50&s_kn=IM&n_sk=10&c_sk=50&s_sk=IM&n_ab=10&c_ab=50&s_ab=IM&n_wa=10&c_wa=50&s_wa=IM&n_dw=10&a_iw=g&a_iw=i&a_iw=d&a_iw=t&n_wc=10&c_wc=50&c_in=50&n_ws=10&c_ws=50&c_wv=50&n_wn=10&c_wn=50&n_cw=10&s_cw=CIP&g=Go'
        )])

    def test_getContent3(self):
        print getContent([
            (1,
             u'http://www.onetonline.org/link/result/11-3071.01?c=tk&n_tk=0&e_tk=1&c_tk=50&s_tk=IM&n_tt=20&s_tt=s&e_tt=L&e_tt=C&n_kn=10&c_kn=50&s_kn=IM&n_sk=10&c_sk=50&s_sk=IM&n_ab=10&c_ab=50&s_ab=IM&n_wa=10&c_wa=50&s_wa=IM&n_dw=10&a_iw=g&a_iw=i&a_iw=d&a_iw=t&n_cx=10&c_cx=50&c_in=50&n_ws=10&c_ws=50&c_wv=50&n_wn=10&c_wn=50&n_cw=10&s_cw=CIP&g=Go'
             ),
            (1,
             u'http://www.onetonline.org/link/result/11-3071.02?c=tk&n_tk=0&e_tk=1&c_tk=50&s_tk=IM&n_tt=20&s_tt=s&e_tt=L&e_tt=C&n_kn=10&c_kn=50&s_kn=IM&n_sk=10&c_sk=50&s_sk=IM&n_ab=10&c_ab=50&s_ab=IM&n_wa=10&c_wa=50&s_wa=IM&n_dw=10&a_iw=g&a_iw=i&a_iw=d&a_iw=t&n_cx=10&c_cx=50&c_in=50&n_ws=10&c_ws=50&c_wv=50&n_wn=10&c_wn=50&n_cw=10&s_cw=CIP&g=Go'
             ),
            (1,
             u'http://www.onetonline.org/link/result/11-3071.03?c=tk&n_tk=0&e_tk=1&c_tk=50&s_tk=IM&n_tt=20&s_tt=s&e_tt=L&e_tt=C&n_kn=10&c_kn=50&s_kn=IM&n_sk=10&c_sk=50&s_sk=IM&n_ab=10&c_ab=50&s_ab=IM&n_wa=10&c_wa=50&s_wa=IM&n_dw=10&a_iw=g&a_iw=i&a_iw=d&a_iw=t&n_cx=10&c_cx=50&c_in=50&n_ws=10&c_ws=50&c_wv=50&n_wn=10&c_wn=50&n_cw=10&s_cw=CIP&g=Go'
             )
        ])


if __name__ == '__main__':
    unittest.main()
コード例 #5
0
from time import sleep
import pytest
from _pytest import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import json

regurl = "https://v2.whil.blue/sponsor/tml"
if __name__ == '__main__':
    import xmlrunner

    unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))
def test_login():


    driver = webdriver.Firefox()
    driver.get("https://v2.whil.blue")
    with open("credentials.json") as f:
        a = json.load(f)
    for i in a.items():
        driver.get("https://v2.whil.blue")
        driver.find_element_by_name("email").send_keys(i[0])
        driver.find_element_by_name("password").send_keys(i[1], Keys.ENTER)
        sleep(1)
        url = driver.current_url
        if driver.current_url == "https://v2.whil.blue/":
            print("%s did NOT login" % i[0])
        elif driver.current_url == "https://v2.whil.blue/home":
            print("%s is logged in SUCCESSFULLY" % i[0])
        elif "https://v2.whil.blue/onboarding/" in driver.current_url:
            print("%s is on board" % i[0])
コード例 #6
0
ファイル: check_list_tests.py プロジェクト: Mikhail9090/JDI
        CommonActionsData.check_action("Fire: condition changed to true")

    def test_get_name(self):
        Assert.assert_equal(self.check_list.get_name(), "nature_check_list")

    def test_are_selected(self):
        Assert.assert_equal(self.check_list.are_selected(), [])

    def test_are_deselected(self):
        Assert.assert_equal(self.check_list.are_deselected(), self.nature_options)

    def test_get_value(self):
        Assert.assert_equal(self.check_list.get_value(), None)


    def check_all_checked(self):
        driver = JDISettings.get_driver_factory().get_driver()
        els = driver.find_elements(By.CSS_SELECTOR, value="#elements-checklist input")
        for el in els:
            Assert.assert_true(el.get_attribute("checked") == "true")

    def check_all_unchecked(self):
        driver = JDISettings.get_driver_factory().get_driver()
        els = driver.find_elements(By.CSS_SELECTOR, value="#elements-checklist input")
        for el in els:
            Assert.assert_true(el.get_attribute("checked") in ["false", None])


if __name__ == "__main__":
    unittest.main()