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


Python expected_conditions.visibility_of_element_located方法代码示例

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


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

示例1: __login

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def __login(self):
        if self.debug: self.driver.save_screenshot(self.directory + r'01.png')
        txt_login = self.driver.find_element_by_id('ctl00_ContentPlaceHolder1_txtLogin')
        txt_login.clear()
        txt_login.send_keys(os.environ['CPF'])

        time.sleep(3.0)
        txt_senha = self.driver.find_element_by_id('ctl00_ContentPlaceHolder1_txtSenha')
        txt_senha.clear()
        txt_senha.send_keys(os.environ['SENHA_CEI'])
        time.sleep(3.0)

        if self.debug: self.driver.save_screenshot(self.directory + r'02.png')

        btn_logar = self.driver.find_element_by_id('ctl00_ContentPlaceHolder1_btnLogar')
        btn_logar.click()

        try:
            WebDriverWait(self.driver, 60).until(EC.visibility_of_element_located((By.ID, 'objGrafPosiInv')))
        except Exception as ex:
            raise Exception('Nao foi possivel logar no CEI. Possivelmente usuario/senha errada ou indisponibilidade do site')

        if self.debug: self.driver.save_screenshot(self.directory + r'03.png') 
开发者ID:guilhermecgs,项目名称:ir,代码行数:25,代码来源:crawler_cei.py

示例2: __recupera_tipo_ticker

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def __recupera_tipo_ticker(self):
        WebDriverWait(CrawlerAdvfn.driver, 10).until(EC.visibility_of_element_located((By.ID, 'quoteElementPiece5')))
        tipo = CrawlerAdvfn.driver.find_element_by_id('quoteElementPiece5').text.lower()

        if tipo == 'futuro':
            return TipoTicker.FUTURO

        if tipo == 'opção':
            return TipoTicker.OPCAO

        if tipo == 'preferencial' or tipo == 'ordinária':
            return TipoTicker.ACAO

        if tipo == 'fundo':
            if self.__fundo_eh_fii():
                return TipoTicker.FII

            if self.__fundo_eh_etf():
                return TipoTicker.ETF

        return None 
开发者ID:guilhermecgs,项目名称:ir,代码行数:23,代码来源:crawler_advfn.py

示例3: test05CreateNewProjectWithAllFiles

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def test05CreateNewProjectWithAllFiles(self):
        self.login()
        WebDriverWait(self.browser, 5).until(EC.visibility_of_element_located((By.XPATH, '//button[@title="upload data files"]')))

        self.browser.find_element_by_xpath('//button[@title="upload data files"]').click()
        WebDriverWait(self.browser, 5).until(EC.visibility_of_element_located((By.ID, 'uploadTitle')))
        self.browser.find_element_by_id('uploadTitle').send_keys('test_project_with_all_files')
        self.browser.find_element_by_id('uploadDescription').send_keys('description of test project')
        self.browser.find_element_by_id('treeFileSelect').send_keys(self.BASEPATH+'tree.txt')
        self.browser.find_element_by_id('fastaFileSelect').send_keys(self.BASEPATH+'fasta.fa')
        self.browser.find_element_by_id('dataFileSelect').send_keys(self.BASEPATH+'view_data.txt')
        self.browser.find_element_by_id('samplesOrderFileSelect').send_keys(self.BASEPATH+'samples-order.txt')
        self.browser.find_element_by_id('samplesInformationFileSelect').send_keys(self.BASEPATH+'samples-information.txt')
        self.browser.find_element_by_id('uploadFiles').click()
        WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.LINK_TEXT, 'test_project_with_all_files')))
        self.assertTrue(self.browser.find_element_by_link_text('test_project_with_all_files')) 
开发者ID:merenlab,项目名称:anvio,代码行数:18,代码来源:run_server_tests.py

示例4: get_latest_wallpapers

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def get_latest_wallpapers():
    browser = webdriver.PhantomJS(PHANTOMJS_PATH, service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
    today_date = time.strftime("%d+%b+%Y")  
    yesterday = datetime.now() - timedelta(days=1)
    yesterday_date = yesterday.strftime('%d+%b+%Y')
    first_page_url = 'http://www.espncricinfo.com/ci/content/image/?datefrom='+yesterday_date+'&dateupto='+today_date+';'
    browser.get(first_page_url)
    wait = WebDriverWait(browser, 10)
    wait.until(EC.visibility_of_element_located((By.CLASS_NAME, "img-wrap")))
    time.sleep(2)
    # let's parse our html
    soup = BeautifulSoup(browser.page_source, "html.parser")
    images = soup.find_all('div', class_='picture')
    for image in images:
        url = "http://www.espncricinfo.com/" + image.find('a').get('href')
        print(url) 
开发者ID:DedSecInside,项目名称:Awesome-Scripts,代码行数:18,代码来源:scrape_espncricinfo.py

示例5: find_element

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def find_element(browser, locator, locator_strategy=By.CSS_SELECTOR, except_on_timeout=True, visible=False, delay=CHECK_IF_EXISTS_TIMEOUT):
    if except_on_timeout:
        if visible:
            element = WebDriverWait(browser, delay).until(
                ec.visibility_of_element_located((locator_strategy, locator)))
        else:
            element = WebDriverWait(browser, delay).until(
                ec.presence_of_element_located((locator_strategy, locator)))
        return element
    else:
        try:
            if visible:
                element = WebDriverWait(browser, delay).until(
                    ec.visibility_of_element_located((locator_strategy, locator)))
            else:
                element = WebDriverWait(browser, delay).until(
                    ec.presence_of_element_located((locator_strategy, locator)))
            return element
        except TimeoutException as e:
            log.debug(e)
            log.debug("Check your {} locator: {}".format(locator_strategy, locator))
            # print the session_id and url in case the element is not found
            if browser is webdriver.Remote:
                # noinspection PyProtectedMember
                log.debug("In case you want to reuse session, the session_id and _url for current browser session are: {},{}".format(browser.session_id, browser.command_executor._url)) 
开发者ID:timelyart,项目名称:Kairos,代码行数:27,代码来源:tv.py

示例6: wait_for_visible

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def wait_for_visible(self, selector='', **kwargs):
        '''
        Wait for an element to be visible.

        Parameters
        ----------
        selector: str
            A CSS selector to search for. This can be any valid CSS selector.

        kwargs:
            Passed on to _wait_for

        '''
        if selector.startswith('/'):
            by = By.XPATH
        else:
            by = By.CSS_SELECTOR
        self._wait_for(EC.visibility_of_element_located((by, selector)),
                       **kwargs) 
开发者ID:IntuitiveWebSolutions,项目名称:PyWebRunner,代码行数:21,代码来源:WebRunner.py

示例7: login

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def login(self, uemail):
        self.open(reverse('accounts:login'))
        WebDriverWait(self.selenium, 10).until(
            EC.presence_of_element_located((By.ID, 'id_username')))
        WebDriverWait(self.selenium, 10).until_not(
            EC.visibility_of_element_located((By.ID, 'div-spinner'))
        )
        self.selenium.find_element_by_id('id_username').send_keys(uemail)
        self.selenium.find_element_by_id('id_password').send_keys(boguspwd)
        self.selenium.find_element_by_id('submit-id-sign_in').click()
        # Wait for the user profile page
        WebDriverWait(self.selenium, 10).until(
            EC.visibility_of_element_located(
                (By.XPATH, '//div[@id="workflow-index"]')
            )
        )

        self.assertIn('reate a workflow', self.selenium.page_source) 
开发者ID:abelardopardo,项目名称:ontask_b,代码行数:20,代码来源:__init__.py

示例8: click_dropdown_option_and_wait

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def click_dropdown_option_and_wait(self, dd_xpath, option_name,
        wait_for=None):
        """
        Given a dropdown xpath, click to open and then click on the given option
        :param dd_xpath: xpath to locate the dropdown element (top level)
        :param option_name: name of the option in the dropdown to click
        :param wait_for: @id to wait for, or modal open if none.
        :return: Nothing
        """
        self.click_dropdown_option(dd_xpath, option_name)

        if wait_for:
            WebDriverWait(self.selenium, 10).until(
                EC.presence_of_element_located(
                    (By.ID, wait_for)
                )
            )
            WebDriverWait(self.selenium, 10).until_not(
                EC.visibility_of_element_located((By.ID, 'div-spinner'))
            )
        else:
            self.wait_for_modal_open() 
开发者ID:abelardopardo,项目名称:ontask_b,代码行数:24,代码来源:__init__.py

示例9: access_workflow_from_home_page

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def access_workflow_from_home_page(self, wname):
        xpath = '//h5[contains(@class, "card-header") and ' \
                'normalize-space(text()) = "{0}"]'

        # Verify that this is the right page
        self.assertIn('New workflow', self.selenium.page_source)
        self.assertIn('Import workflow', self.selenium.page_source)

        WebDriverWait(self.selenium, 10).until(EC.element_to_be_clickable(
            (By.XPATH, xpath.format(wname))
        ))
        self.selenium.find_element_by_xpath(xpath.format(wname)).click()
        WebDriverWait(self.selenium, 10).until(
            EC.presence_of_element_located((By.ID, 'action-index'))
        )
        WebDriverWait(self.selenium, 10).until_not(
            EC.visibility_of_element_located((By.ID, 'div-spinner'))
        ) 
开发者ID:abelardopardo,项目名称:ontask_b,代码行数:20,代码来源:__init__.py

示例10: findElement

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def findElement(parent, css_selector):
    """
    Menemukan element dengan CSS Selector.
    """

    try:
        elem = waitingResult(visibility_of_element_located, By.CSS_SELECTOR, css_selector)
        return elem
    except NoSuchElementException:
        return None 
开发者ID:brutemap-dev,项目名称:brutemap,代码行数:12,代码来源:core.py

示例11: open_locust_homepage

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def open_locust_homepage(self):
        self.client.get("http://locust.io/")
        self.client.wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, '//a[text()="Documentation"]')
            )
        ) 
开发者ID:nickboucart,项目名称:realbrowserlocusts,代码行数:9,代码来源:locustfile.py

示例12: click_through_to_documentation

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def click_through_to_documentation(self):
        self.client\
            .find_element_by_xpath('//a[text()="Documentation"]').click()
        self.client.wait.until(
            EC.visibility_of_element_located(
                (By.XPATH, '//h1[text()="Locust Documentation"]')
            )
        ) 
开发者ID:nickboucart,项目名称:realbrowserlocusts,代码行数:10,代码来源:locustfile.py

示例13: __recupera_preco_atual

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def __recupera_preco_atual(self):
        WebDriverWait(CrawlerAdvfn.driver, 10).until(EC.visibility_of_element_located((By.ID, 'quoteElementPiece10')))
        preco_atual = float(CrawlerAdvfn.driver.find_element_by_id('quoteElementPiece10').text
                            .replace('.', '').replace(',', '.'))
        return preco_atual 
开发者ID:guilhermecgs,项目名称:ir,代码行数:7,代码来源:crawler_advfn.py

示例14: _wait_until_element_is_visible_by_locator

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def _wait_until_element_is_visible_by_locator(context, locator_tuple,
                                              timeout=TIMEOUT_IN_S):
    wait = WebDriverWait(context.browser, timeout)
    wait.until(EC.visibility_of_element_located(locator_tuple))
    return context.browser.find_element(locator_tuple[0], locator_tuple[1]) 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:7,代码来源:common.py

示例15: wait_until_button_is_visible

# 需要导入模块: from selenium.webdriver.support import expected_conditions [as 别名]
# 或者: from selenium.webdriver.support.expected_conditions import visibility_of_element_located [as 别名]
def wait_until_button_is_visible(context, title, timeout=TIMEOUT_IN_S):
    wait = WebDriverWait(context.browser, timeout)
    locator_tuple = (By.XPATH, ("//%s[contains(.,'%s')]" % ('button', title)))
    wait.until(EC.visibility_of_element_located(locator_tuple)) 
开发者ID:leapcode,项目名称:bitmask-dev,代码行数:6,代码来源:common.py


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