當前位置: 首頁>>代碼示例>>Python>>正文


Python expected_conditions.title_is方法代碼示例

本文整理匯總了Python中selenium.webdriver.support.expected_conditions.title_is方法的典型用法代碼示例。如果您正苦於以下問題:Python expected_conditions.title_is方法的具體用法?Python expected_conditions.title_is怎麽用?Python expected_conditions.title_is使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在selenium.webdriver.support.expected_conditions的用法示例。


在下文中一共展示了expected_conditions.title_is方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: wait_for_page

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def wait_for_page(self, title=None, element_id=None):
        if title:
            WebDriverWait(self.selenium, 10).until(
                EC.title_is(title)
            )

        WebDriverWait(self.selenium, 10).until(
            EC.presence_of_element_located((By.ID, 'div-spinner'))
        )
        WebDriverWait(self.selenium, 10).until(
            EC.invisibility_of_element_located((By.ID, 'img-spinner'))
        )

        if element_id:
            WebDriverWait(self.selenium, 10).until(
                EC.presence_of_element_located((By.ID, element_id))
            ) 
開發者ID:abelardopardo,項目名稱:ontask_b,代碼行數:19,代碼來源:__init__.py

示例2: run_for_driver

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def run_for_driver(driver, test):
    driver.implicitly_wait(30)
    driver.get("http://127.0.0.1:" + test.port)
    wait = WebDriverWait(driver, 30)
    wait.until(EC.title_is("tqsdk-python-web"))  # k線圖顯示
    logo = driver.find_element_by_tag_name("img")
    test.assertEqual("Tianqin", logo.get_attribute("alt"))
    # K線是否有成交箭頭
    chart_main_marks = driver.find_element_by_css_selector("svg.tqchart>g.root g.main.marks")
    trade_arrow_paths = chart_main_marks.find_element_by_css_selector("g.tradearrow")
    wait = WebDriverWait(driver, 30)
    wait.until(element_has_child(trade_arrow_paths, "path"))
    # 成交列表是否顯示
    trades_table = driver.find_element_by_css_selector("div.reports.trades-table>table")
    wait = WebDriverWait(driver, 30)
    wait.until(element_has_child(trades_table, "tbody>tr"))
    driver.close() 
開發者ID:shinnytech,項目名稱:tqsdk-python,代碼行數:19,代碼來源:test_web_backtest.py

示例3: run_for_driver

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def run_for_driver(driver, test):
    driver.implicitly_wait(30)
    driver.get("http://127.0.0.1:" + test.port)
    wait = WebDriverWait(driver, 30)
    wait.until(EC.title_is("tqsdk-python-web"))  # k線圖顯示
    logo = driver.find_element_by_tag_name("img")
    test.assertEqual("Tianqin", logo.get_attribute("alt"))
    account_info = driver.find_element_by_class_name("account-info")
    accounts = account_info.find_elements_by_tag_name("div")
    test.assertEqual(5, len(accounts))
    # 測試K線圖是否顯示
    chart_main_candle = driver.find_element_by_css_selector("svg.tqchart>g.root g.plot.main.candle")
    main_candle_paths = chart_main_candle.find_elements_by_tag_name("path")
    test.assertEqual(6, len(main_candle_paths))
    up_body = chart_main_candle.find_element_by_css_selector("path.candle.body.up")
    down_body = chart_main_candle.find_element_by_css_selector("path.candle.body.down")
    up_line = chart_main_candle.find_element_by_css_selector("path.candle.line.equal")
    down_line = chart_main_candle.find_element_by_css_selector("path.candle.line.equal")
    wait = WebDriverWait(driver, 30)
    wait.until(path_element_has_d(up_body))  # k線圖顯示
    wait.until(path_element_has_d(down_body))
    wait.until(path_element_has_d(up_line))
    wait.until(path_element_has_d(down_line))
    driver.close() 
開發者ID:shinnytech,項目名稱:tqsdk-python,代碼行數:26,代碼來源:test_web.py

示例4: test01RegisterNewUser

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def test01RegisterNewUser(self):
        self.browser.get('http://'+self.URL)
        self.browser.find_element_by_link_text('Register').click()
        WebDriverWait(self.browser, 5).until(EC.title_is('anvio account registration'))
        self.browser.find_element_by_id('inputFirstname').send_keys('Test')
        self.browser.find_element_by_id('inputLastname').send_keys('User')
        self.browser.find_element_by_id('inputAffiliation').send_keys('anvio')
        self.browser.find_element_by_id('inputLogin').send_keys(self.USER+'2')
        self.browser.find_element_by_id('inputPassword').send_keys('test')
        self.browser.find_element_by_id('inputRepeatPassword').send_keys('test')
        self.browser.find_element_by_id('inputEmail').send_keys(self.EMAIL)
        self.browser.find_element_by_id('submit').click()
        WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.XPATH, '//div[@class="alert alert-success col-sm-6"]')))
        self.assertTrue(self.browser.find_element_by_xpath('//div[@class="alert alert-success col-sm-6"]')) 
開發者ID:merenlab,項目名稱:anvio,代碼行數:16,代碼來源:run_server_tests.py

示例5: test02Login

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def test02Login(self):
        self.login()
        WebDriverWait(self.browser, 5).until(EC.title_is('anvio user home'))
        self.assertIn('anvio user home', self.browser.title) 
開發者ID:merenlab,項目名稱:anvio,代碼行數:6,代碼來源:run_server_tests.py

示例6: test03ForgotPasswordInvalid

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def test03ForgotPasswordInvalid(self):
        self.browser.get('http://'+self.URL)
        self.browser.find_element_by_link_text('forgot password?').click()
        WebDriverWait(self.browser, 5).until(EC.title_is('anvio forgot password'))
        self.browser.find_element_by_id('inputEmail').send_keys('invalid@email.com')
        self.browser.find_element_by_id('submit').click()
        WebDriverWait(self.browser, 5).until(EC.alert_is_present())
        self.assertEqual('Resetting password failed: No user has been found for email address "invalid@email.com"', Alert(self.browser).text) 
開發者ID:merenlab,項目名稱:anvio,代碼行數:10,代碼來源:run_server_tests.py

示例7: test04ForgotPasswordValid

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def test04ForgotPasswordValid(self):
        self.browser.get('http://'+self.URL)
        self.browser.find_element_by_link_text('forgot password?').click()
        WebDriverWait(self.browser, 5).until(EC.title_is('anvio forgot password'))
        self.browser.find_element_by_id('inputEmail').send_keys(self.USER+'@email')
        self.browser.find_element_by_id('submit').click()
        WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.XPATH, '//div[@class="alert alert-success col-sm-6"]')))
        self.assertTrue(self.browser.find_element_by_xpath('//div[@class="alert alert-success col-sm-6"]')) 
開發者ID:merenlab,項目名稱:anvio,代碼行數:10,代碼來源:run_server_tests.py

示例8: test07SelectProject

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def test07SelectProject(self):
        self.login()
        WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.LINK_TEXT, 'test_project_with_all_files')))
        self.browser.find_element_by_link_text('test_project_with_all_files').click()
        WebDriverWait(self.browser, 5).until(EC.title_is('test_project_with_all_files'))
        self.assertIn('test_project_with_all_files', self.browser.title) 
開發者ID:merenlab,項目名稱:anvio,代碼行數:8,代碼來源:run_server_tests.py

示例9: wait_for_title

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def wait_for_title(self, title, **kwargs):
        '''
        Wait for the page title to match given title.

        Parameters
        ----------
        title: str
            The page title to wait for

        kwargs:
            Passed on to _wait_for

        '''
        self._wait_for(EC.title_is(title), **kwargs) 
開發者ID:IntuitiveWebSolutions,項目名稱:PyWebRunner,代碼行數:16,代碼來源:WebRunner.py

示例10: wait_for_title

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def wait_for_title(self, title, timeout):
        """Wait for page title to be the given value

        :Args:
        - title: expected title
        - timeout: time to wait (in seconds)
        """
        wait = WebDriverWait(self, timeout)
        message = 'Timeout waiting for title to be \'{}\''.format(title)
        wait.until(ec.title_is(title), message=message) 
開發者ID:golemhq,項目名稱:golem,代碼行數:12,代碼來源:extended_driver.py

示例11: wait_for_title_is_not

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def wait_for_title_is_not(self, title, timeout):
        """Wait for page title to not be the given value

        :Args:
        - title: not expected title
        - timeout: time to wait (in seconds)
        """
        wait = WebDriverWait(self, timeout)
        message = 'Timeout waiting for title to not be \'{}\''.format(title)
        wait.until_not(ec.title_is(title), message=message) 
開發者ID:golemhq,項目名稱:golem,代碼行數:12,代碼來源:extended_driver.py

示例12: login

# 需要導入模塊: from selenium.webdriver.support import expected_conditions [as 別名]
# 或者: from selenium.webdriver.support.expected_conditions import title_is [as 別名]
def login(self):
        print("正在打開二維碼登陸界麵,請稍後")
        self.driver.get("https://pc.xuexi.cn/points/login.html")
        try:
            remover = WebDriverWait(self.driver, 30, 0.2).until(
                lambda driver: driver.find_element_by_class_name("redflagbox"))
        except exceptions.TimeoutException:
            print("網絡緩慢,請重試")
        else:
            self.driver.execute_script('arguments[0].remove()', remover)
        try:
            remover = WebDriverWait(self.driver, 30, 0.2).until(
                lambda driver: driver.find_element_by_class_name("header"))
        except exceptions.TimeoutException:
            print("當前網絡緩慢...")
        else:
            self.driver.execute_script('arguments[0].remove()', remover)
        try:
            remover = WebDriverWait(self.driver, 30, 0.2).until(
                lambda driver: driver.find_element_by_class_name("footer"))
        except exceptions.TimeoutException:
            print("當前網絡緩慢...")
        else:
            self.driver.execute_script('arguments[0].remove()', remover)
            self.driver.execute_script('window.scrollTo(document.body.scrollWidth/2 - 200 , 0)')
        try:
            WebDriverWait(self.driver, 270).until(EC.title_is(u"我的學習"))
            cookies = self.get_cookies()
            return cookies
        except:
            print("掃描二維碼超時") 
開發者ID:Alivon,項目名稱:Panda-Learning,代碼行數:33,代碼來源:mydriver.py


注:本文中的selenium.webdriver.support.expected_conditions.title_is方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。