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


Python WebDriverWait.get_attribute方法代码示例

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


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

示例1: test_partial_publication

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
 def test_partial_publication(self):
     self.login_author()
     self.selenium.get(self.live_server_url + self.ignored_part.get_absolute_url())
     find_element = self.selenium.find_element_by_css_selector
     button = WebDriverWait(self.selenium, 20)\
         .until(expected_conditions.element_to_be_clickable((By.CSS_SELECTOR, '.readiness')))
     readiness = button.get_attribute('data-is-ready')
     button.click()
     self.wait_element_attribute_change((By.CSS_SELECTOR, '.readiness'), 'data-is-ready', readiness, 20)
     self.content = PublishableContent.objects.get(pk=self.content.pk)
     self.ignored_part = self.content.load_version().children[1]
     self.assertFalse(self.ignored_part.ready_to_publish, 'part should be marked as not ready to publish')
     self.selenium.get(self.live_server_url + self.content.get_absolute_url())
     self.selenium.get(self.live_server_url + self.ignored_part.get_absolute_url())
     button = find_element('.readiness')
     self.assertNotEqual(readiness, button.get_attribute('data-is-ready'),
                         'part should be marked as not ready to publish')
     self.selenium.get(self.live_server_url + self.content.get_absolute_url())
     self.ask_validation()
     self.logout()
     self.login_staff()
     self.take_reservation()
     self.validate()
     url = PublishedContent.objects.get(content__pk=self.content.pk).get_absolute_url_online()
     self.selenium.get(self.live_server_url + url)
     self.assertRaises(WebDriverException, find_element, 'a[href="{}"]'.format(
         reverse('tutorial:view-container', kwargs={
             'slug': self.content.slug,
             'pk': self.content.pk,
             'container_slug': self.ignored_part.slug
         })))
开发者ID:josephcab,项目名称:zds-site,代码行数:33,代码来源:tests_front.py

示例2: get_max_page_num

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
 def get_max_page_num(self):
     max_num = WebDriverWait(self.driver, 20, 0.1).until(
         lambda d: d.find_element_by_class_name(self.TOTAL_NUM))
     size = max_num.get_attribute("innerText")
     if not size:
         size = max_num.text
     return int(size)
开发者ID:AlexandraSmirnova,项目名称:homework-4,代码行数:9,代码来源:pages.py

示例3: get_page_num_from_browser

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
 def get_page_num_from_browser(self):
     current_num = WebDriverWait(self.driver, 20, 0.1).until(
         lambda d: d.find_element_by_xpath(self.CURRENT_NUM))
     size = current_num.get_attribute("innerText")
     if not size:
         size = current_num.text
     return int(size)
开发者ID:AlexandraSmirnova,项目名称:homework-4,代码行数:9,代码来源:pages.py

示例4: assertHasValue

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
    def assertHasValue(self, locator, rule, value, timeout=-1, exact=True, case_sensitive=True, msg=None):
        """assert the current form field has the requested value

        :param locator: the engine to process the rule
        :type locator: selenium.webdriver.common.by.By
        :param rule: the rule the element must match
        :type rule: str:
        :param value: the requested value
        :param timeout: if positive, driver will wait for the element to appear
        :type timeout: int
        :param exact: if ``True`` check the value is exactly the requested value. if ``False`` check ``value`` is a \
        substring of the field value attribute
        :type exact: bool
        :param case_sensitive: if ``True`` comparison will be case insensitive
        :type case_sensitive: bool
        """
        try:
            if timeout > 0:
                element = WebDriverWait(self.driver, timeout).until(
                        EC.element_to_be_clickable((locator, rule))
                )
            else:
                element = self.driver.find_element(locator, rule)
        except (NoSuchElementException, TimeoutException) as e:
            raise self.failureException(str(e))
        element_value = element.get_attribute("value")
        if not case_sensitive:
            value = value.lower()
            element_value = element_value.lower()
        if exact:
            self.assertEqual(element_value, value, msg=msg)
        else:
            self.assertIn(value, element_value, msg=msg)
开发者ID:dcolam,项目名称:test-automation-framework,代码行数:35,代码来源:UITestCase.py

示例5: test_edit_film

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
    def test_edit_film(self):
        movieTitle = "Devchata"
        imdbNumber = "0134614"
        duration = "92"
        rating = "8.362"
        linkTrailer = "https://www.youtube.com/watch?v=LaCUkjlQuVw"
        year = "1961"


        driver = self.driver
        driver.get(self.base_url + "/php4dvd/")
        username = driver.find_element_by_id("username")
        username.send_keys("admin")
        password = driver.find_element_by_name("password")
        password.send_keys("admin")
        driver.find_element_by_name("submit").click()

        movie = WebDriverWait(self.driver, 30).until(
            EC.presence_of_element_located((By.CSS_SELECTOR, "#results div[title='" + movieTitle + "']"))
        )
        movie.click()

        edit = WebDriverWait(self.driver, 30).until(
            EC.presence_of_element_located((By.CSS_SELECTOR, "#content nav ul li:nth-child(3) a"))
        )
        edit.click()

        imdbidField = WebDriverWait(self.driver, 30).until(
            EC.presence_of_element_located((By.NAME, "imdbid"))
        )
        imdbidField.send_keys(imdbNumber)
        durationField = driver.find_element_by_name("duration")
        durationField.send_keys(duration)
        ratingField = driver.find_element_by_name("rating")
        ratingField.send_keys(rating)
        trailerField = driver.find_element_by_name("trailer")
        trailerField.send_keys(linkTrailer)

        save = driver.find_element_by_id("submit")
        save.click();

        h2Title = WebDriverWait(self.driver, 30).until(
            EC.presence_of_element_located((By.CSS_SELECTOR, ".maininfo_full h2"))
        )
        self.assertEqual(h2Title.text, movieTitle + " (" + year + ")")

        driver.find_element_by_css_selector("#content nav ul li:nth-child(5) a").click()

        imdbidField2 = WebDriverWait(self.driver, 30).until(
            EC.presence_of_element_located((By.NAME, "imdbid"))
        )
        durationField2 = driver.find_element_by_name("duration")
        ratingField2 = driver.find_element_by_name("rating")
        trailerField2 = driver.find_element_by_name("trailer")

        self.assertEqual(imdbidField2.get_attribute("value"), imdbNumber)
        self.assertEqual(durationField2.get_attribute("value"), duration)
        self.assertEqual(ratingField2.get_attribute("value"), rating)
        self.assertEqual(trailerField2.get_attribute("value"), linkTrailer)
开发者ID:eabramovich,项目名称:selenium-py-training-abramovich,代码行数:61,代码来源:edit_film_test.py

示例6: assert_low_checked

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
 def assert_low_checked(self):
     checkbox = WebDriverWait(self.driver, WebDriverSettings.WEBDRIVER_TIMEOUT,
                              WebDriverSettings.WEBDRIVER_POLL_FREQUENCY).until(
         lambda d: d.find_element_by_css_selector(self.LOW_LEVEL)
     )
     if checkbox.get_attribute("checked") == "true":
         return True
     else:
         return False
开发者ID:krygin,项目名称:tech-testing-ha2,代码行数:11,代码来源:income_checkbox_group.py

示例7: process_chunk

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
def process_chunk(state,district,block):
   
    try:
        display = Display(visible=0, size=(1024, 768))
        display.start()
        driver = webdriver.Firefox()

        driver.get("http://omms.nic.in/Home/")
        main_menu = WebDriverWait(driver,10).until(EC.presence_of_element_located((By.CSS_SELECTOR,"a.menuLnk")))
        #main_menu = driver.find_element_by_css_selector("a.menuLnk")
        main_click = main_menu.get_attribute('onclick')
        time.sleep(3)
        driver.execute_script("return "+main_click)
        time.sleep(3)

        for year in range(2000,2017):
            #State: Rajasthan     District: Ajmer     Block: Arain     Year : 2000-2001      Batch: All Batches   
            print "Accessing data for state: ", state, " district: ", district, " block: ", block, " year: ", year,"..."
            year = str(year)
            access_string = str("http://omms.nic.in/MvcReportViewer.aspx?_r=%2fPMGSYCitizen%2fSanctionedProjects&Level=3&State="+state[0]+"&District="+district[0]+"&Block="+block[0]+"&Year="+year+"&Batch=0&PMGSY=1&DisplayStateName="+state[1]+"&DisplayDistName="+district[1]+"&DispBlockName="+block[1]+"&LocalizationValue=en&BatchName=All+Batches") 
            time.sleep(5) 
            #print access_string
            driver.get(access_string)
            #let it load
            time.sleep(10)

            #Find the right CSS web element using Chrome
            elem = WebDriverWait(driver,10).until(EC.presence_of_all_elements_located((By.CSS_SELECTOR,"div[id$='208iT0R0x0'] > a")))
            time.sleep(3)
            hov = ActionChains(driver).move_to_element(elem[1])
            hov.perform()
            time.sleep(3)
            elem[1].click()
            time.sleep(5)

            link = driver.find_elements_by_css_selector('div#ReportViewer_ctl05_ctl04_ctl00_Menu > div > a')
            button_name = link[1].get_attribute('onclick')
            time.sleep(3)
            try:
                driver.execute_script("return "+button_name)
            except: print "Page is being updated"
            #Allow to finish download
            time.sleep(5)

            #harvest(state,district,block,year)

        driver.close()
        display.stop()
    except: 
        print "Unknown exception" 
        pass
开发者ID:ASvyatkovskiy,项目名称:WebScraping,代码行数:53,代码来源:db_scraper_iterative.py

示例8: get_campaign_name

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
 def get_campaign_name(self):
     element = WebDriverWait(self.driver, 30, 3).until(
         lambda el: el.find_element_by_css_selector(self.CAMPAIGN_NAME)
     )
     return element.get_attribute('value')
开发者ID:deyl94,项目名称:tech-testing-ha2,代码行数:7,代码来源:create_page.py

示例9: get_url

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
 def get_url(self):
     element = WebDriverWait(self.driver, 30, 3).until(
         lambda el: el.find_element_by_css_selector(self.URL)
     )
     return element.get_attribute('value')
开发者ID:deyl94,项目名称:tech-testing-ha2,代码行数:7,代码来源:campaign_page.py

示例10: test_autoland_inbound

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
    def test_autoland_inbound(self):
        # We should not be able to land to inbound without a HostingService
        # with an associated inbound repository.
        self.reviewboard_login('[email protected]', 'password2')
        self.load_rburl('r/1')
        autoland_btn = self.browser.find_element_by_id('autoland-trigger')
        self.assertEqual(
            autoland_btn.value_of_css_property('opacity'), '0.5')
        self.add_hostingservice(1, 'Sirius Black', 'scm_level_1',
                                'try',
                                'inbound', '')

        # We should also not be able to land to inbound unless the review is
        # published.
        self.reviewboard_login('[email protected]', 'password2')
        self.load_rburl('r/1')
        autoland_btn = self.browser.find_element_by_id('autoland-trigger')
        self.assertEqual(
            autoland_btn.value_of_css_property('opacity'), '0.5')
        self.assign_reviewer(0, 'jsmith')
        publish_btn = WebDriverWait(self.browser, 3).until(
                        EC.visibility_of_element_located((By.ID,
                        'btn-draft-publish')))
        publish_btn.click()

        WebDriverWait(self.browser, 10).until(
            EC.invisibility_of_element_located((By.ID, 'draft-banner')))

        # We should also not be able to land to inbound unless ship-it has
        # been granted.
        autoland_btn = self.browser.find_element_by_id('autoland-trigger')
        self.assertEqual(
            autoland_btn.value_of_css_property('opacity'), '0.5')

        self.ship_it(2, '[email protected]', 'password2')
        self.load_rburl('r/1')

        automation_menu = self.browser.find_element_by_id('automation-menu')
        automation_menu.click()
        autoland_btn = self.browser.find_element_by_id('autoland-trigger')
        self.assertEqual(
            autoland_btn.value_of_css_property('opacity'), '1')

        # Clicking the button should display a trychooser dialog
        autoland_btn.click()

        element = WebDriverWait(self.browser, 10).until(
            EC.visibility_of_element_located((By.ID, 'activity-indicator'))
        )
        try:
            self.assertTrue('A server error occurred' not in element.text)
        except StaleElementReferenceException:
            # The activity indicator may already have disappeared by the time
            # we check the text, but we want to be able to catch the server
            # error if it shows up.
            pass

        self.browser.refresh()
        action_info = WebDriverWait(self.browser, 10).until(
            EC.visibility_of_element_located((By.CLASS_NAME, 'action-info'))
        )
        self.assertTrue('https://treeherder.mozilla.org/'
            in action_info.get_attribute('innerHTML'))

        # We should have closed the review request automatically
        submitted_banner = self.browser.find_element_by_id('submitted-banner')
        self.assertTrue('This change has been marked as submitted.' in
                        submitted_banner.get_attribute('innerHTML'))

        # We should not be able to autoland from a closed review request
        try_btn = self.browser.find_element_by_id('autoland-try-trigger')
        self.assertEqual(
            try_btn.value_of_css_property('opacity'), '0.5')
        autoland_btn = self.browser.find_element_by_id('autoland-trigger')
        self.assertEqual(
            autoland_btn.value_of_css_property('opacity'), '0.5')
开发者ID:pombredanne,项目名称:version-control-tools,代码行数:78,代码来源:test-autoland-inbound.py

示例11: mark_user_top_user_message

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
        def mark_user_top_user_message(self):
            marks_list = self.browser.find_elements_by_xpath(
                ".//*[@id='starBox']//a[@data-index='9' or @data-index='10']"
            )
            for mark in marks_list:
                profileLink1 = self.browser.find_element_by_xpath("//div[@id='userPhotoLayout']/a").get_attribute(
                    "href"
                )
                hover = ActionChains(self.browser).move_to_element(mark)
                hover.perform()
                try:
                    self.browser.implicitly_wait(5)
                    mark.click()
                    try:
                        high_rate_comment = WebDriverWait(self.browser, 5).until(
                            lambda driver: driver.find_element_by_xpath(
                                ".//*[@id='extraQuestions']//div[@class='questions-list']/textarea"
                            )
                        )
                        assert u"Свой вариант" == high_rate_comment.get_attribute("placeholder")

                        if high_rate_comment.get_attribute("style") == "":
                            print "style = " + high_rate_comment.get_attribute("style")
                        else:
                            print "Style of the element exists, but it shouldn't"
                            raise Exception("Style of the element exists, but it shouldn't")

                        high_rate_comment.click()
                        try:
                            WebDriverWait(self.browser, 5).until(
                                lambda driver: driver.find_element_by_xpath(
                                    ".//*[@id='extraQuestions']//div[@class='questions-list']/textarea"
                                )
                                .get_attribute("style")
                                .count("35px")
                                > 0
                            )
                        except Exception:
                            print "Textarea expanding didn't happen"

                            #                    Validate that message contains more that 1 symbol
                        high_rate_comment.send_keys(u"1")
                        self.browser.find_element_by_id("btnSendExtra").click()
                        try:
                            validate_alert_form_ok = WebDriverWait(self.browser, 5).until(
                                lambda driver: driver.find_element_by_xpath(
                                    ".//div[text()='Ваше сообщение слишком короткое, напишите более развернуто.']//a"
                                )
                            )
                            validate_alert_form_ok.click()
                        except NoSuchElementException:
                            print "Element not found. Too short message alert"
                            #                   End validation
                        high_rate_comment.send_keys(u"Привет")
                        self.browser.find_element_by_id("btnSendExtra").click()
                    except NoSuchElementException:
                        pass
                    except TimeoutException:
                        print "Textarea not found"
                except ElementNotVisibleException:
                    print "Element NOT visible = " + mark.get_attribute("innerHTML")
                profileLink2 = self.browser.find_element_by_xpath("//div[@id='userPhotoLayout']/a").get_attribute(
                    "href"
                )
                print "Element = " + mark.get_attribute("innerHTML")
                print profileLink1
                print profileLink2

                assert profileLink1 != profileLink2

            self.browser.find_element_by_id("exit").click()
            self.browser.close()
开发者ID:ngavrish,项目名称:tester,代码行数:74,代码来源:ScratchMarksSending.py

示例12: mark_user_top_standart_messages

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
        def mark_user_top_standart_messages(self):
            marks_list = self.browser.find_elements_by_xpath(
                ".//*[@id='starBox']//a[@data-index='9' or @data-index='10']"
            )
            for mark in marks_list:
                profileLink1 = self.browser.find_element_by_xpath("//div[@id='userPhotoLayout']/a").get_attribute(
                    "href"
                )
                hover = ActionChains(self.browser).move_to_element(mark).click()
                hover.perform()
                try:
                    high_rate_comment = WebDriverWait(self.browser, 5).until(
                        lambda driver: driver.find_element_by_xpath(
                            ".//*[@id='extraQuestions']//div[@class='questions-list']/textarea"
                        )
                    )
                    assert u"Свой вариант" == high_rate_comment.get_attribute("placeholder")
                    print high_rate_comment.get_attribute("placeholder")

                    if high_rate_comment.get_attribute("style") != "":
                        print "style = " + high_rate_comment.get_attribute("style")
                        raise Exception("Style of the element exists, but it shouldn't")

                    try:
                        random_compliments = WebDriverWait(self.browser, 5).until(
                            lambda driver: driver.find_elements_by_xpath(
                                ".//*[@id='extraQuestions']//div[@class='questions-list']//label[contains(@class,'message-variant random-compliments')]"
                            )
                        )
                    except TimeoutException:
                        raise TimeoutException("Compliments box not found")

                    for compliment in random_compliments:
                        initial_textarea_value = self.browser.execute_script(
                            "return $(\"textarea[class='extra-rate-comment-area not-empty']\").val()"
                        )
                        ActionChains(self.browser).move_to_element(high_rate_comment).click()
                        self.browser.implicitly_wait(2)
                        compliment.click()
                        self.browser.implicitly_wait(2)
                        print compliment.get_attribute("innerHTML")
                        # debug output //
                        try:
                            WebDriverWait(self.browser, 5).until(
                                lambda driver: driver.find_element_by_xpath(
                                    ".//*[@id='extraQuestions']//div[@class='questions-list']/textarea"
                                )
                                .get_attribute("style")
                                .count("35px")
                                > 0
                            )
                        except Exception:
                            raise Exception("Textarea expanding didn't happen")
                            # validate that textarea text has changed
                        print initial_textarea_value
                        print self.browser.execute_script(
                            "return $(\"textarea[class='extra-rate-comment-area not-empty']\").val()"
                        )
                        assert initial_textarea_value != self.browser.execute_script(
                            "return $(\"textarea[class='extra-rate-comment-area not-empty']\").val()"
                        )
                except NoSuchElementException:
                    pass
                except TimeoutException:
                    print "Textarea not found"
                self.browser.find_element_by_id("btnSendExtra").click()

            profileLink2 = self.browser.find_element_by_xpath("//div[@id='userPhotoLayout']/a").get_attribute("href")
            print "Element = " + mark.get_attribute("innerHTML")

            assert profileLink1 != profileLink2

            self.browser.find_element_by_id("exit").click()
            self.browser.close()
开发者ID:ngavrish,项目名称:tester,代码行数:76,代码来源:ScratchMarksSending.py

示例13: test_autoland_inbound

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
    def test_autoland_inbound(self):
        # We should not be able to land to inbound without a HostingService
        # with an associated inbound repository.
        self.reviewboard_login('[email protected]', 'password2')
        self.load_rburl('r/1')
        autoland_btn = self.browser.find_element_by_id('autoland-trigger')
        self.assertEqual(
            autoland_btn.value_of_css_property('opacity'), '0.5')
        self.add_hostingservice(1, 'Sirius Black', 'scm_level_1',
                                'try',
                                'inbound', '')

        # We should also not be able to land to inbound unless the review is
        # published.
        self.reviewboard_login('[email protected]', 'password2')
        self.load_rburl('r/1')
        autoland_btn = self.browser.find_element_by_id('autoland-trigger')
        self.assertEqual(
            autoland_btn.value_of_css_property('opacity'), '0.5')
        self.assign_reviewer(0, 'jsmith')
        publish_btn = WebDriverWait(self.browser, 3).until(
            EC.visibility_of_element_located((By.ID, 'btn-draft-publish')))
        publish_btn.click()

        WebDriverWait(self.browser, 10).until(
            EC.invisibility_of_element_located((By.ID, 'draft-banner')))

        # We should also not be able to land to inbound unless ship-it has
        # been granted.
        autoland_btn = self.browser.find_element_by_id('autoland-trigger')
        self.assertEqual(
            autoland_btn.value_of_css_property('opacity'), '0.5')

        self.ship_it(2, '[email protected]', 'password2')
        self.load_rburl('r/1')

        automation_menu = self.browser.find_element_by_id('automation-menu')
        automation_menu.click()
        autoland_btn = self.browser.find_element_by_id('autoland-trigger')
        self.assertEqual(
            autoland_btn.value_of_css_property('opacity'), '1')

        # Clicking the button should display the autoland dialog
        autoland_btn.click()

        # Wait for commit rewrite response, which enables the submit btn
        autoland_submit_btn = WebDriverWait(self.browser, 10).until(
            EC.element_to_be_clickable((By.ID, 'autoland-submit'))
        )
        autoland_submit_btn.click()

        # autoland submission triggers a browser refresh, wait for that
        WebDriverWait(self.browser, 10).until(
            EC.visibility_of_element_located((By.CLASS_NAME, 'action-info'))
        )

        # Wait for autoland to process the request
        loading = True
        iteration = 0
        while loading and iteration < 10:
            action_info = WebDriverWait(self.browser, 10).until(
                EC.visibility_of_element_located(
                    (By.CLASS_NAME, 'action-info')
                )
            )
            loading = action_info.get_attribute('innerHTML').find(
                'Waiting for the Autoland request') != -1
            if loading:
                time.sleep(1)
                self.browser.refresh()
                iteration += 1
        self.assertFalse(loading)

        # We should have closed the review request automatically
        submitted_banner = self.browser.find_element_by_id('submitted-banner')
        self.assertTrue('This change has been marked as submitted.' in
                        submitted_banner.get_attribute('innerHTML'))

        # We should not be able to autoland from a closed review request
        try_btn = self.browser.find_element_by_id('autoland-try-trigger')
        self.assertEqual(
            try_btn.value_of_css_property('opacity'), '0.5')
        autoland_btn = self.browser.find_element_by_id('autoland-trigger')
        self.assertEqual(
            autoland_btn.value_of_css_property('opacity'), '0.5')
开发者ID:pkdevboxy,项目名称:version-control-tools,代码行数:87,代码来源:test-autoland-inbound.py

示例14: Return_incoming_price_product

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
 def Return_incoming_price_product(self):
     incom_price = WebDriverWait(self.driver, 3).until(
         EC.presence_of_element_located((By.XPATH, "//order-details//tabset//tab[3]/div[3]/div[2]//span/input"))
     )
     return incom_price.get_attribute("value")
开发者ID:denskif,项目名称:CRM_test,代码行数:7,代码来源:CRM_side_Trading.py

示例15: get_all_items

# 需要导入模块: from selenium.webdriver.support.wait import WebDriverWait [as 别名]
# 或者: from selenium.webdriver.support.wait.WebDriverWait import get_attribute [as 别名]
def get_all_items():
    display = Display(visible=0, size=(1024, 768))
    display.start()
    driver = webdriver.Firefox()

    driver.get("http://omms.nic.in/Home/")
    main_menu = WebDriverWait(driver,10).until(EC.presence_of_element_located((By.CSS_SELECTOR,"a.menuLnk")))
    #main_menu = driver.find_element_by_css_selector("a.menuLnk")
    main_click = main_menu.get_attribute('onclick')
    time.sleep(3)
    driver.execute_script("return "+main_click)
    time.sleep(3)


    print "Getting all states, districts and blocks..."
    all_items = dict()
    state_element = driver.find_element_by_xpath("//select[@name='StateCode']")
    state_options = state_element.find_elements_by_tag_name("option")
    state_count = len(state_options)
    for state_i in xrange(1,state_count):
        state_option = get_i_option(driver, "StateCode", state_i)
        state = (state_option.get_attribute("value"),state_option.text)
        print "state ", state
        all_items[state] = dict()
        state_option.click()
        time.sleep(3)

        district_element = driver.find_element_by_xpath("//select[@name='DistrictCode']")
        district_options = district_element.find_elements_by_tag_name("option")
        district_count = len(district_options)
        ##case when there is no district 
        district_start = 1
        if district_count == 0:
            district_start = 0
            district_count = 1
        for district_i in xrange(district_start,district_count):
            try: 
                district_option = get_i_option(driver, "DistrictCode", district_i)
                district = (district_option.get_attribute("value"),district_option.text)
            except: district = (0,"All+Districts")
            print "district ", district
            all_items[state][district] = list()
            district_option.click()
            time.sleep(7)  

            block_element = driver.find_element_by_xpath("//select[@name='BlockCode']")
            block_options = block_element.find_elements_by_tag_name("option")
            block_count = len(block_options)
            #case when there is no block
            block_start = 1
            if block_count == 0:
                block_start = 0
                block_count = 1
            for block_i in xrange(block_start,block_count):
                #print "block_i ", block_i
                try:
                    block_option = get_i_option(driver, "BlockCode", block_i)
                    block = (block_option.get_attribute("value"),block_option.text)
                except: block = (0,"All+Blocks")
                print "block ", block
                all_items[state][district].append(block)
    driver.close()
    display.stop()

    return all_items
开发者ID:ASvyatkovskiy,项目名称:WebScraping,代码行数:67,代码来源:db_scraper_iterative.py


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