当前位置: 首页>>代码示例>>Python>>正文


Python WebDriverWait.split方法代码示例

本文整理汇总了Python中selenium.webdriver.support.ui.WebDriverWait.split方法的典型用法代码示例。如果您正苦于以下问题:Python WebDriverWait.split方法的具体用法?Python WebDriverWait.split怎么用?Python WebDriverWait.split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在selenium.webdriver.support.ui.WebDriverWait的用法示例。


在下文中一共展示了WebDriverWait.split方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_search_results

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import split [as 别名]
def load_search_results(n=None):
    result = []
    try:
        terms = load_terms()
        if n is not None:
            terms = terms.head(n=n)
        browser = webdriver.Firefox()
        for term_id, term_name in progress.bar(terms[['identifier', 'name']].values):
            if ';' in term_name:
                term_name = term_name.split(';')[0]
            while True:
                browser.get('https://www.google.com/search?q={}'.format(term_name))
                try:
                    stats = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, 'resultStats'))).text
                except TimeoutException:
                    browser.quit()
                    sleep(10)
                    browser = webdriver.Firefox()
                    continue
                try:
                    count = int(stats.split(':')[1].split('(')[0].replace(' ', ''))
                except Exception:
                    print(stats)
                    raise Exception()
                result.append({
                    'identifier': term_id,
                    'search_results': count,
                    'search_results_log': numpy.log(count),
                })
                break
    finally:
        browser.quit()
    return pandas.DataFrame(result)
开发者ID:papousek,项目名称:analysis,代码行数:35,代码来源:raw.py

示例2: get_month_year

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import split [as 别名]
 def get_month_year(self):
     """Break a date string into a month year tuple."""
     calendar_heading = WebDriverWait(self.driver, 5).until(
         expect.visibility_of_element_located(
             (By.XPATH,
              '//div[contains(@class,"calendar-header-label")]/span')
         )
     ).text
     month, year = calendar_heading.split(' ')
     return self.get_month_number(month), int(year)
开发者ID:sisiz,项目名称:staxing,代码行数:12,代码来源:helper.py

示例3: _load_search_results_apply

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import split [as 别名]
def _load_search_results_apply(term_id, term_name):
    if ';' in term_name:
        term_name = term_name.split(';')[0]
    global BROWSER
    BROWSER.get('https://www.google.com/search?q={}'.format(term_name))
    while True:
        try:
            stats = WebDriverWait(BROWSER, 60).until(EC.presence_of_element_located((By.ID, 'resultStats'))).text
            if 'About' in stats:
                count = int(stats.split(' ')[1].replace(',', ''))
            else:
                count = int(stats.split(':')[1].split('(')[0].replace(' ', ''))
            return {
                'identifier': term_id,
                'search_results': count,
                'search_results_log': numpy.log(count),
            }
        except Exception as e:
            import traceback
            traceback.print_exc(e)
            sleep(5)
开发者ID:papousek,项目名称:analysis,代码行数:23,代码来源:raw.py

示例4: getText

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import split [as 别名]
    def getText(self):
        """Function to return a list of the text.

        Raises:
            TimeoutException: If typing paragraph doesn't appear.
        """

        driver = self.driver

        try:
            text = WebDriverWait(driver,load_delay).until(
                EC.visibility_of_element_located(
                    (By.CLASS_NAME,"nonHideableWords")
                    )
                ).text
            arrText = text.split(' ')
        except TimeoutException:
            curr_err_msg = err_msgs["ERR_SIX"]

        return arrText
开发者ID:stefanqin,项目名称:TyperacerBot-Python,代码行数:22,代码来源:typebotter.py

示例5: which_gender

# 需要导入模块: from selenium.webdriver.support.ui import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.ui.WebDriverWait import split [as 别名]
 def which_gender(self):
     base_string = WebDriverWait(self.driver, 30, 1).until(
         lambda d: d.find_element_by_css_selector(self.GENDER_STRING).text
     )
     gender_string = base_string.split(',')
     return gender_string[0]
开发者ID:Buratinkalol,项目名称:tech-testing-ha2,代码行数:8,代码来源:Component.py


注:本文中的selenium.webdriver.support.ui.WebDriverWait.split方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。