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


Python Browser.is_element_not_present_by_xpath方法代码示例

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


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

示例1: SchemaTestCase

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import is_element_not_present_by_xpath [as 别名]

#.........这里部分代码省略.........
            "//div[@class='content2-first']/h2").first.value
        self.assertEqual(text, 'Type')
        self.browser.find_by_name('name').first.fill("Bob's type")
        self.browser.find_by_id('advancedModeButton').first.click()
        self.browser.find_by_name('properties-0-key').first.fill('auto increment name')
        self.browser.find_by_name('properties-0-display').first.check()
        self.browser.find_by_name('properties-0-required').first.check()
        self.browser.find_by_xpath("//select[@id='id_properties-0-datatype']/optgroup[@label='Auto']/option[@value='i']").first.click()
        self.browser.find_by_name('properties-0-order').first.fill('1')
        self.browser.find_by_name('properties-0-description').first.fill(
            "The name of this Bob's node")
        self.browser.find_by_value('Save Type').first.click()
        text = self.browser.find_by_id(
            'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
        self.assertEqual(text, "auto increment name")

    def test_new_advanced_type_auto_increment_update(self):
        create_graph(self)
        create_schema(self)
        self.browser.find_link_by_href(
            '/schemas/bobs-graph/types/create/').first.click()
        text = self.browser.find_by_xpath(
            "//div[@class='content2-first']/h2").first.value
        self.assertEqual(text, 'Type')
        self.browser.find_by_name('name').first.fill("Bob's type")
        self.browser.find_by_id('advancedModeButton').first.click()
        self.browser.find_by_name('properties-0-key').first.fill('auto increment update')
        self.browser.find_by_name('properties-0-display').first.check()
        self.browser.find_by_name('properties-0-required').first.check()
        self.browser.find_by_xpath("//select[@id='id_properties-0-datatype']/optgroup[@label='Auto']/option[@value='o']").first.click()
        self.browser.find_by_name('properties-0-order').first.fill('1')
        self.browser.find_by_name('properties-0-description').first.fill(
            "The name of this Bob's node")
        self.browser.find_by_value('Save Type').first.click()
        text = self.browser.find_by_id(
            'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
        self.assertEqual(text, "auto increment update")

    def test_new_advanced_type_auto_user(self):
        create_graph(self)
        create_schema(self)
        self.browser.find_link_by_href(
            '/schemas/bobs-graph/types/create/').first.click()
        text = self.browser.find_by_xpath(
            "//div[@class='content2-first']/h2").first.value
        self.assertEqual(text, 'Type')
        self.browser.find_by_name('name').first.fill("Bob's type")
        self.browser.find_by_id('advancedModeButton').first.click()
        self.browser.find_by_name('properties-0-key').first.fill('auto user name')
        self.browser.find_by_name('properties-0-display').first.check()
        self.browser.find_by_name('properties-0-required').first.check()
        self.browser.find_by_xpath("//select[@id='id_properties-0-datatype']/optgroup[@label='Auto']/option[@value='e']").first.click()
        self.browser.find_by_name('properties-0-order').first.fill('1')
        self.browser.find_by_name('properties-0-description').first.fill(
            "The name of this Bob's node")
        self.browser.find_by_value('Save Type').first.click()
        text = self.browser.find_by_id(
            'diagramBoxField_bobs-graph.bobs-type.undefined').first.value
        self.assertEqual(text, "auto user name")

    def test_schema_allowed_rel_addition(self):
        create_graph(self)
        self.assertEqual(self.browser.title, 'SylvaDB - Dashboard')
        create_schema(self)
        create_type(self)
        self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
        self.browser.find_by_id('allowedRelations').first.click()
        self.browser.select('source', '1')
        self.browser.find_by_name('name').fill('Bob\'s rel')
        self.browser.select('target', '1')
        self.browser.find_by_id('id_description').fill('This the allowed relationship for Bob\'s graph')
        self.browser.find_by_value('Save Type').first.click()
        self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
        text = self.browser.find_by_xpath(
            "//div[@class='form-row indent']/label").first.value
        self.assertNotEqual(text.find('Bob\'s rel'), -1)

    def test_schema_allowed_rel_addition_deletion(self):
        create_graph(self)
        self.assertEqual(self.browser.title, 'SylvaDB - Dashboard')
        create_schema(self)
        create_type(self)
        self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
        self.browser.find_by_id('allowedRelations').first.click()
        self.browser.select('source', '1')
        self.browser.find_by_name('name').fill('Bob\'s rel')
        self.browser.select('target', '1')
        self.browser.find_by_id('id_description').fill('This the allowed relationship for Bob\'s graph')
        self.browser.find_by_value('Save Type').first.click()
        self.assertEqual(self.browser.title, "SylvaDB - Bob's graph")
        text = self.browser.find_by_xpath(
            "//div[@class='form-row indent']/label").first.value
        self.assertNotEqual(text.find('Bob\'s rel'), -1)
        self.browser.find_by_xpath("//div[@class='form-row indent']/div[@class='form-row indent']/a").first.click()
        self.browser.find_by_xpath("//span[@class='buttonLinkOption buttonLinkRight']/a[@class='delete']").first.click()
        self.browser.choose('confirm', '1')
        self.browser.find_by_value('Continue').first.click()
        notExists = self.browser.is_element_not_present_by_xpath(
            "//div[@class='form-row indent']/label")
        self.assertEqual(notExists, True)
开发者ID:gabmunrio,项目名称:Sylva,代码行数:104,代码来源:schema.py

示例2: GeneralGetter

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import is_element_not_present_by_xpath [as 别名]

#.........这里部分代码省略.........
                    doc = html.document_fromstring(unicode(self.splinter__browser.html.decode('utf-8')))
                else:
                    assert False  # rest of browser not yet supported..
                scream.log_debug(str(url), True)
                scream.say('Continue to work on ' + url)
                scream.say('Page source sent further')

                #splinter__browser.screenshot(name=repository.key, suffix='.png')

                scream.say('Verify if 404 (repo deleted) otherwise keep on going')
                parallax = doc.xpath('//div[@id="parallax_illustration"]')

                if (len(parallax) > 0):
                    scream.say('Verified that 404 (repo deleted)')
                    result['status'] = '404'
                    break

                scream.say('Verified that not 404')

                scream.say('Verify if repo empty otherwise keep on going')
                repo_empty = doc.xpath('//div[@class="blankslate has-fixed-width"]')

                if (len(repo_empty) > 0):
                    scream.say('Verified that repo is empty')
                    result['status'] = 'EMPTY'
                    break

                scream.say('Verified that repo not empty')

                if splinter__driver == 'phantomjs':
                    #WebDriverWait(splinter__browser, 10).until(waiter)
                    while True:
                        scream.say("Wait for the AJAX to do the magic")
                        if self.splinter__browser.is_element_not_present_by_xpath('//span[@class="octicon octicon-organization"]//..//..//text()[normalize-space(.)="Fetching contributors"]', wait_time=5):
                            break
                        else:
                            scream.say("AJAX didnt work on time")
                    doc = html.document_fromstring(unicode(self.splinter__browser.html))

                assert "Fetching contributors" not in doc

                ns = doc.xpath('//ul[@class="numbers-summary"]')
                sunken = doc.xpath('//ul[@class="sunken-menu-group"]')

                scream.say('XPath made some search for ' + url + ' .. move on to bsoup..')
                scream.say('Xpath done searching')
                scream.say('Element found?: ' + str(len(ns) == 1))

                element = ns[0]
                element_sunken = sunken[0]
                local_soup = BeautifulSoup(etree.tostring(element))
                local_soup_sunken = BeautifulSoup(etree.tostring(element_sunken))

                enumarables = local_soup.findAll("li")
                enumarables_more = local_soup_sunken.findAll("li")

                commits = enumarables[0]
                scream.say('enumarables[0]')
                commits_number = analyze_tag(commits.find("span", {"class": "num"}))
                scream.say('analyze_tag finished execution for commits_number')
                scream.say('Before parse number: ' + str(commits_number))
                result['commits'] = parse_number(commits_number)
                scream.log_debug(result['commits'], True)
                scream.say('enumarables[1]')
                branches = enumarables[1]
                branches_number = analyze_tag(branches.find("span", {"class": "num"}))
开发者ID:oskar-j,项目名称:supra-repos-x,代码行数:70,代码来源:intelliGitThreaded.py


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