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


Python Browser.click_link_by_partial_href方法代码示例

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


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

示例1: TestViews

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import click_link_by_partial_href [as 别名]
class TestViews(unittest.TestCase):
    def setUp(self):
        """ Test setup """
        self.browser = Browser("phantomjs")

        # Set up the tables in the database
        Base.metadata.create_all(engine)

        # Create an example user
        self.user = models.User(name="Alice", email="[email protected]",
                                password=generate_password_hash("test"))
        session.add(self.user)
        session.commit()

        self.process = multiprocessing.Process(target=app.run)
        self.process.start()
        time.sleep(1)
        

    def test_add_post(self):
        log= logging.getLogger("unittest.TestCase")
        
        ################################## Login as Alice
        #self.browser.visit("http://0.0.0.0:8080/login") # original line
        self.browser.visit("http://127.0.0.1:5000/login")
        self.browser.fill("email", "[email protected]")
        self.browser.fill("password", "test")
        button = self.browser.find_by_css("button[type=submit]")
        button.click()
        #self.assertEqual(self.browser.url, "http://0.0.0.0:8080/") # original line
        # self.assertEqual(self.browser.url, "http://127.0.0.1:5000/") # ask sam about this line
        
############################################ add a test post #####################
        self.browser.visit("http://127.0.0.1:5000")
        self.browser.click_link_by_partial_href('add')
        self.browser.fill("title", "post test1 title")
        self.browser.fill("content", "post test1 content")
        button = self.browser.find_by_css("button[type=submit]")
        button.click()
        post_found = self.browser.find_by_tag('h1').value #cheated here - made template title h2. how do we access? index?
        #post_found = self.browser.find_by_text('post test1 title').value - didnt work
        
        log.debug( "FIRSTH1= %r", post_found )
        
        self.assertEqual(post_found, "post test1 title")

    def tearDown(self):
        """ Test teardown """
        # Remove the tables and their data from the database
        self.process.terminate()
        session.close()
        engine.dispose()
        Base.metadata.drop_all(engine)
        self.browser.quit()
开发者ID:bb071988,项目名称:blog,代码行数:56,代码来源:test_extensions.py

示例2: UserTest

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import click_link_by_partial_href [as 别名]
class UserTest(StaticLiveServerTestCase):
    def setUp(self):
        check_permissions()
        self.username = "antonio"
        create_user(self.username)

        self.browser = Browser()
        self.browser.visit(self.live_server_url)

    def test_signup(self):
        signup_url = settings.SIGNUP_URL
        self.browser.click_link_by_partial_href(signup_url)

        username = "andres"
        password = "andres"
        email = "[email protected]"
        signup(self.browser, username, password, email)

        user_exists = exists_user(username)
        self.assertTrue(user_exists)

        user = get_user(username)
        self.assertEquals(user.username, username)
        # self.assertEquals(user.password, password)
        self.assertEquals(user.email, email)

        document_list_url = self.live_server_url + reverse("documents.views.list_documents")
        self.assertEquals(self.browser.url, document_list_url)

        profile_xpath = "/html/body/div/div[1]/div/ul[2]/li[4]/a"
        profile_link = self.browser.find_by_xpath(profile_xpath)
        self.assertEquals(profile_link.value, "@{}".format(username))

        #        import time; time.sleep(3)
        self.browser.quit()

    def test_signin(self):
        login_url = settings.LOGIN_URL
        self.browser.click_link_by_partial_href(login_url)

        username = self.username
        password = self.username
        login(self.browser, username, password)

        document_list_url = self.live_server_url + reverse("documents.views.list_documents")
        self.assertEquals(self.browser.url, document_list_url)

        profile_xpath = "/html/body/div/div[1]/div/ul[2]/li[4]/a"
        profile_link = self.browser.find_by_xpath(profile_xpath)
        self.assertEquals(profile_link.value, "@{}".format(username))

        #        import time; time.sleep(3)
        self.browser.quit()
开发者ID:CulturePlex,项目名称:festos,代码行数:55,代码来源:test_user.py

示例3: download_art

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import click_link_by_partial_href [as 别名]
def download_art(title):

    browser = Browser()
    # Visit URL
    url = "http://gen.lib.rus.ec/scimag/index.php"
    browser.visit(url)

    article_title = browser.find_by_name('s')
    article_title.fill(title)

    button = browser.find_by_value('Search!')
    # Interact with elements
    button.click()

    #sleep is use at each step to control the follow between program and internet speed

    time.sleep(10)
    browser.click_link_by_text('Libgen')
    time.sleep(15)
    browser.click_link_by_partial_href('http://gen.lib.rus.ec/scimag/get.php')

    time.sleep(5)
    browser.quit()
开发者ID:Akash1684,项目名称:ScriptsPy,代码行数:25,代码来源:research_art.py

示例4: reload

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import click_link_by_partial_href [as 别名]
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

import sys, os
from splinter import Browser

reload(sys)
sys.setdefaultencoding('utf-8')

br = Browser()

file_prefix = 'file://'
dir_name    = os.path.dirname(os.path.realpath(__file__))
file_name   = "output.html"

full_path   = file_prefix + dir_name + '/' + file_name

br.visit(full_path)
br.click_link_by_partial_href('/releases/ac?artist_id=')
开发者ID:HaraldNordgren,项目名称:rateyourmusic,代码行数:21,代码来源:read-file.py

示例5: TestViews

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import click_link_by_partial_href [as 别名]
class TestViews(unittest.TestCase):
    def setUp(self):
        """ Test setup """
        self.browser = Browser("phantomjs")
        
        # Set up the tables in the database
        Base.metadata.create_all(engine)
        
        # Create an example user
        self.user = User(name="Alice", email="[email protected]",
                        password=generate_password_hash("test"))
        session.add(self.user)
        session.commit()
        
        self.process = multiprocessing.Process(target=app.run,
                                                kwargs={"port": 8080})
                                                
        self.process.start()
        time.sleep(1)
        
    def test_login_correct(self):
        self.browser.visit("http://127.0.0.1:8080/login")
        self.browser.fill("email", "[email protected]")
        self.browser.fill("password", "test")
        button = self.browser.find_by_css("button[type=submit]")
        button.click()
        self.assertEqual(self.browser.url, "http://127.0.0.1:8080/")
        
    def test_login_incorrect(self):
        self.browser.visit("http://127.0.0.1:8080/login")
        self.browser.fill("email", "[email protected]")
        self.browser.fill("password", "test")
        button = self.browser.find_by_css("button[type=submit]")
        button.click()
        self.assertEqual(self.browser.url, "http://127.0.0.1:8080/login")
        
    def test_add_entry(self):
        # Login to blog
        self.test_login_correct()
        # Add new entry
        self.browser.visit("http://127.0.0.1:8080/entry/add")
        self.browser.fill("title", "test post")
        self.browser.fill("content", "acceptance testing post")
        self.browser.find_by_css("button[type=submit]").first.click()
        self.assertEqual(self.browser.url, "http://127.0.0.1:8080/")
        
    def test_view_single_entry(self):
        # Login to blog
        self.test_login_correct()
        # Click on top entry title
        self.browser.visit("http://127.0.0.1:8080/entry/1/")
        self.assertEqual(self.browser.url, "http://127.0.0.1:8080/entry/1/")
        
    def test_edit_entry(self):
        # Login to blog
        self.test_login_correct()
        # Add new entry
        self.browser.visit("http://127.0.0.1:8080/entry/add")
        self.browser.fill("title", "test post")
        self.browser.fill("content", "acceptance testing post")
        self.browser.find_by_css("button[type=submit]").first.click()
        # Click edit link on top entry
        self.browser.click_link_by_partial_href('edit')
        # Enter new title and contents
        self.browser.fill("title", "edited test post")
        self.browser.fill("content", "edited acceptance testing post")
        self.browser.find_by_css("button[type=submit]").first.click()
        self.assertEqual(self.browser.url, "http://127.0.0.1:8080/")
    
    def test_delete_entry(self):
        # Login to blog
        self.test_login_correct()
        # Add new entry
        self.browser.visit("http://127.0.0.1:8080/entry/add")
        self.browser.fill("title", "test post")
        self.browser.fill("content", "acceptance testing post")
        self.browser.find_by_css("button[type=submit]").first.click()
        # Delete entry
        self.browser.click_link_by_partial_href('delete')
        button = self.browser.find_by_css("button[type=submit]")
        button.click()
        # Make sure browser puts you back on home 
        self.assertEqual(self.browser.url, "http://127.0.0.1:8080/")
    
    def test_logout(self):
        # Login to blog
        self.test_login_correct()
        # Click on 'Logout' link
        self.browser.click_link_by_text('Logout')
        # Check to see if 'Logout' link is visible
        self.assertEqual(self.browser.is_element_present_by_text('Logout'), False)
        # Check to see if 'Login' link is visible
        self.assertEqual(self.browser.is_element_present_by_text('Login'), True)
        
    def tearDown(self):
        """ Test teardown """
        # Remove the tables and their data from the database
        self.process.terminate()
        session.close()
        engine.dispose()
#.........这里部分代码省略.........
开发者ID:tydonk,项目名称:blogful,代码行数:103,代码来源:test_views_acceptance.py

示例6: WOS

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

#.........这里部分代码省略.........
            else:
                return sys.exit("Session Id could not be found")    
        else:
            logging.info("No redirection to service")
            return sys.exit("Invalid credentials")
        
    def launch_search(self):
        """ Filling the query form found into advanced search page """
        logging.info("Launching search")
        
        if self.browser_app == "splinter":
            self.browser.fill("value(input1)", self.query)
            self.browser.find_by_xpath("/html/body/div[1]/form/div[1]/table/tbody/tr/td[1]/div[2]/div[1]/table/tbody/tr/td[1]/span[1]/input").click()
            bs = BeautifulSoup(self.browser.html)
            
        else:
            self.session.wk_fill('textarea[id="value(input1)"]', self.query)
            self.session.click('input[title="Search"]')
            self.session.wait(random.randint(2,5))
            
            bs = BeautifulSoup(self.browser.html.encode("utf-8"))
        
        query_history = bs.find_all("div", {"class":"historyResults"})
        self.nb_search = len(query_history)
        try:
            self.nb_results = int(re.sub(",", "", query_history[0].text))
        except IndexError:
            self.nb_results = int(re.sub(",", "", query_history.text))
            print self.nb_results
            
        logging.warning("Your search \"%s\" gave %i results"%(self.query, self.nb_results))
        logging.info("Your SSID is : %s" %self.ssid)
        if self.browser_app == "splinter":
            self.browser.click_link_by_partial_href('/summary.do?')
        else:
            self.session.click('a[title="Click to view the results"]',wait_load=True)
            
        print urlparse(self.browser.url).query
        match = re.search(re.compile("product=WOS&doc\=(?P<doc>.*?)\&qid\=(?P<qid>.*?)&SID"), urlparse(self.browser.url).query)        
        if match is not None:
            print match.group()
            self.doc, self.qid = match.group("doc"), match.group('qid')
            print self.doc, self.qid
            return self
        else:
            
            self.doc, self.qid = self.parse_params()
            return self
            
    
    def load_results(self, markFrom, markTo, i):
        """ Load_results(markFrom, markTo) 500 by 500 given the nb of results """
        logging.info("loading results")
        #print "exporting"
        #p_url0= "http://apps.webofknowledge.com/AutoSave_UA_output.do?action=saveForm&SID=%s&product=UA&search_mode=output" %self.ssid
        #r0 = requests.post(p_url0, headers= headers, cookies=self.cookies)
        # print p_url0
        #print r0
        #p_url1= "http://apps.webofknowledge.com/AutoSave_UA_output.do?action=saveForm&SID=%s&product=UA&search_mode=results" %self.ssid
        # print p_url1
        #r1 = requests.post(p_url1, headers= headers, cookies=self.cookies)
        #print r1
        r_url = "https://apps-webofknowledge-com.fennec.u-pem.fr/summary.do?product=WOS&doc=1&qid="+self.qid+"&SID="+self.ssid+"&search_mode=AdvancedSearch"
        post_url = "https://apps-webofknowledge-com.fennec.u-pem.fr/OutboundService.do?action=go&&"
        #r2 = requests.post()
开发者ID:cortext,项目名称:wostext,代码行数:69,代码来源:wos.py

示例7: SearchTest

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import click_link_by_partial_href [as 别名]
class SearchTest(StaticLiveServerTestCase):
    def setUp(self):
        fss.remove_tree(settings.MEDIA_ROOT)
        check_permissions()
        set_site(self.live_server_url)
        
        self.browser = Browser()
        self.browser.visit(self.live_server_url)
        
        login_url = settings.LOGIN_URL
        self.browser.click_link_by_partial_href(login_url)
        
        username = 'antonio'
        password = 'antonio'
        create_user(username)
        login(
            self.browser,
            username,
            password,
        )
        
        upload_url = reverse('documents.views.add_document')
        self.browser.click_link_by_partial_href(upload_url)
        
        source = 'local'
        docfile = get_abs_path('doctest.pdf')
        language = 'eng'
        public = True
        title = 'test'
        notes = 'test notes'
        upload(
            self.browser,
            source,
            docfile,
            language,
            public,
            title,
            notes,
        )
        
        self.browser.is_element_not_present_by_value('ready', 10)
        
        self.title = title
        import time; time.sleep(1)
    
    def test_search_title(self):
        self.browser.visit(self.live_server_url)
        
        title = 'test'
        
        driver = self.browser.driver
        actions = ActionChains(driver)
        searchbar_xpath = '//*[@id="search"]/div/div/div[2]'
        searchbar_div = driver.find_element_by_xpath(searchbar_xpath)
        actions.move_to_element(searchbar_div)
        actions.click()
        actions.perform()
        
        menu_title_xpath = '/html/body/ul/li[4]/a'
        menu_title = self.browser.find_by_xpath(menu_title_xpath)
        menu_title.click()
        input_title_xpath = \
            '//*[@id="search"]/div/div/div[2]/div[2]/div[2]/input'
        input_title = self.browser.find_by_xpath(input_title_xpath)
        input_title.type(title + '\r')
        
        search_list_url = \
            self.live_server_url + '/?title=' + title + '&'
        self.assertEquals(self.browser.url, search_list_url)
        
        summary_xpath = '/html/body/div/div[2]/p/small'
        summary = self.browser.find_by_xpath(summary_xpath)
        self.assertEquals(summary.value, '1 documents found')
        
        document_img_xpath = '/html/body/div/div[2]/ul/li/a/img'
        document_img = self.browser.find_by_xpath(document_img_xpath).click()
        viewer_title_xpath = (
            '//*[@id="documentviewer-container"]'
            '/div/div[1]/div[1]/div[1]/div[2]/h4/a'
        )
        viewer_title = self.browser.find_by_xpath(viewer_title_xpath)
        self.assertEquals(viewer_title.value, self.title)
        
#        import time; time.sleep(3)
        self.browser.quit()
    
    def test_search_text(self):
        self.browser.visit(self.live_server_url)
        
        text = 'download'
        
        driver = self.browser.driver
        actions = ActionChains(driver)
        searchbar_xpath = '//*[@id="search"]/div/div/div[2]'
        searchbar_div = driver.find_element_by_xpath(searchbar_xpath)
        actions.move_to_element(searchbar_div)
        actions.click()
        actions.perform()
        
        menu_text_xpath = '/html/body/ul/li[3]/a'
#.........这里部分代码省略.........
开发者ID:CulturePlex,项目名称:festos,代码行数:103,代码来源:test_search.py

示例8: TagTest

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import click_link_by_partial_href [as 别名]
class TagTest(StaticLiveServerTestCase):
    def setUp(self):
        fss.remove_tree(settings.MEDIA_ROOT)
        check_permissions()
        set_site(self.live_server_url)
        
        self.browser = Browser()
        self.browser.visit(self.live_server_url)
        
        login_url = settings.LOGIN_URL
        self.browser.click_link_by_partial_href(login_url)
        
        username = 'antonio'
        password = 'antonio'
        create_user(username)
        login(
            self.browser,
            username,
            password,
        )
        
        upload_url = reverse('documents.views.add_document')
        self.browser.click_link_by_partial_href(upload_url)
        
        source = 'local'
        docfile = get_abs_path('doctest.pdf')
        language = 'eng'
        public = True
        title = 'test'
        notes = 'test notes'
        upload(
            self.browser,
            source,
            docfile,
            language,
            public,
            title,
            notes,
        )
        
        self.browser.is_element_not_present_by_value('ready', 10)
        
        tag = 'tag'
        add_tag(
            self.browser,
            tag,
        )
        
        self.tag = tag
        self.tag_obj = get_tag(tag)
    
    def test_add_tag(self):
        tag_exists = exists_tag(self.tag)
        self.assertTrue(tag_exists)
        self.assertEquals(self.tag_obj.name, self.tag)
        
        document_list_url = \
            self.live_server_url + reverse('documents.views.list_documents')
        self.assertEquals(self.browser.url, document_list_url)
        
        tag_span = self.browser.find_by_css('span.taggit_tag')
        self.assertEquals(tag_span.value, self.tag)
        
#        import time; time.sleep(3)
        self.browser.quit()
    
    def test_add_different_tag(self):
        old_tag_num = len(self.browser.find_by_css('span.taggit_tag'))
        
        tag = 'other'
        add_tag(
            self.browser,
            tag,
        )
        
        new_tag_num = len(self.browser.find_by_css('span.taggit_tag'))
        self.assertEquals(new_tag_num, old_tag_num + 1)
        
#        import time; time.sleep(3)
        self.browser.quit()
    
    def test_add_same_tag(self):
        old_tag_num = len(self.browser.find_by_css('span.taggit_tag'))
        
        tag = self.tag
        add_tag(
            self.browser,
            tag,
        )
        
        new_tag_num = len(self.browser.find_by_css('span.taggit_tag'))
        self.assertEquals(new_tag_num, old_tag_num)
        
#        import time; time.sleep(3)
        self.browser.quit()
    
    def test_remove_tag(self):
        old_tag_num = len(self.browser.find_by_css('span.taggit_tag'))
        
        driver = self.browser.driver
#.........这里部分代码省略.........
开发者ID:CulturePlex,项目名称:festos,代码行数:103,代码来源:test_tag.py

示例9: add_album_to_rym

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import click_link_by_partial_href [as 别名]
def add_album_to_rym(args, config_file):
    br = Browser()

    br.visit('https://rateyourmusic.com/account/login')
    time.sleep(3)

    # Login
    br.fill('username', credentials.username)
    br.fill('password', credentials.password)
    br.find_by_id('login_submit').click()
    time.sleep(5)

    (title, artist, tracklist, release, cover) = config.read_config(config_file)
   

    """
    if args.update_album:

        br.visit(args.rym_album)

    else:
    """

    if args.add_artist:
        br.visit('https://rateyourmusic.com/artist_add')

        #br.fill('lastname', unicode(artist))
        br.fill('lastname', artist)
        br.fill('comments', args.url)

        br.find_by_id('submitbtn').click()

        time.sleep(3)
        
        br.find_by_text(artist).click()
    
    else:
        br.visit(args.rym_profile)
    
    time.sleep(3)
    
    br.click_link_by_partial_href('/releases/ac?artist_id=')
    
    # Add data
    #br.fill('title', unicode(title))
    br.fill('title', title)
    
    br.find_by_id('format58').click()

    br.find_by_id('goAdvancedBtn').click()
    tracks_div = br.find_by_id('tracks_adv')
    tracks_text_area = tracks_div.find_by_id('track_advanced')
    #tracks_text_area.fill(unicode(tracklist)) 
    tracks_text_area.fill(tracklist) 
    br.find_by_id('goSimpleBtn').click()

    br.fill('notes', args.url)
 
    (year, month, day)      = parse_release_date(release)

    release_month_selector  = br.find_by_id('month')
    release_month_selector.select(month)
    
    release_day_selector    = br.find_by_id('day')
    release_day_selector.select(day)
    
    release_year_selector   = br.find_by_id('year')
    release_year_selector.select(year)

    br.find_by_id('previewbtn').click()
    br.find_by_id('submitbtn').click()

    # Add cover art

    """
    coverart_img_element = br.find_by_xpath("//img[@class='coverart_img']")
    print(coverart_im_element)
    sys.exit(0)
    """

    br.click_link_by_partial_href('/images/upload?type=l&assoc_id=')
    br.attach_file('upload_file', cover)

    br.fill('source', args.url)
    br.find_by_id('uploadbutton').click()
    time.sleep(5)

    br.click_link_by_partial_href('javascript:setStatus')


    # Vote for genre
    br.click_link_by_partial_href('/release/')
    time.sleep(3)

    br.click_link_by_partial_href('/rgenre/set?')

    prigen_text_area = br.find_by_xpath("//input[@id='prigen']")
    prigen_text_area.fill('vaporwave')

    prigen_vote_button = br.find_by_xpath("//input[@value='+ propose']").first
#.........这里部分代码省略.........
开发者ID:HaraldNordgren,项目名称:rateyourmusic,代码行数:103,代码来源:rym.py

示例10: DocTest

# 需要导入模块: from splinter import Browser [as 别名]
# 或者: from splinter.Browser import click_link_by_partial_href [as 别名]
class DocTest(StaticLiveServerTestCase):
    def setUp(self):
        fss.remove_tree(settings.MEDIA_ROOT)
        check_permissions()
        set_site(self.live_server_url)
        
        self.browser = Browser()
        self.browser.visit(self.live_server_url)
        
        login_url = settings.LOGIN_URL
        self.browser.click_link_by_partial_href(login_url)
        
        username = 'antonio'
        password = 'antonio'
        create_user(username)
        login(
            self.browser,
            username,
            password,
        )
        
        upload_url = reverse('documents.views.add_document')
        self.browser.click_link_by_partial_href(upload_url)
        
        source = 'local'
        docfile = get_abs_path('doctest.pdf')
        language = 'eng'
        public = True
        title = 'test'
        notes = 'test notes'
        upload(
            self.browser,
            source,
            docfile,
            language,
            public,
            title,
            notes,
        )
        
        self.browser.is_element_not_present_by_value('ready', 10)
        
        self.public = public
        self.title = title
        self.notes = notes
        self.document = get_document(title)
    
    def test_upload_doc_local(self): #Create
        document_exists = exists_document(self.title)
        self.assertTrue(document_exists)
        self.assertEquals(self.document.public, self.public)
        self.assertEquals(self.document.title, self.title)
        self.assertEquals(self.document.notes, self.notes)
        
        document_list_url = \
            self.live_server_url + reverse('documents.views.list_documents')
        self.assertEquals(self.browser.url, document_list_url)
        
        document_xpath = '/html/body/div/div[2]/table/tbody/tr[1]'
        document_tr = self.browser.find_by_xpath(document_xpath)
        document_id = document_tr['data-id']
        self.assertEquals(int(document_id), self.document.id)
        
        document_title_xpath = '//*[@id="documents_cell"]/span[1]'
        document_title = self.browser.find_by_xpath(document_title_xpath)
        self.assertEquals(document_title.value, self.title)
        
        profile_xpath = '/html/body/div/div[1]/div/ul[2]/li[4]/a'
        profile_link = self.browser.find_by_xpath(profile_xpath)
        owner_xpath = '/html/body/div/div[2]/table/tbody/tr[1]/td[4]/a'
        owner_link = self.browser.find_by_xpath(owner_xpath)
        self.assertEquals(profile_link.value, owner_link.value)
        
        status_xpath = '/html/body/div/div[2]/table/tbody/tr/td[5]/div'
        status_div = self.browser.find_by_xpath(status_xpath)
        self.assertEquals(status_div.value, self.document.status)
        
        numpages_xpath = '/html/body/div/div[2]/table/tbody/tr[1]/td[6]/div'
        numpages_div = self.browser.find_by_xpath(numpages_xpath)
        self.assertEquals(int(numpages_div.value), self.document.page_count)
        
        privacy_icon_xpath = '//*[@id="privacy"]/i'
        privacy_icon = self.browser.find_by_xpath(privacy_icon_xpath)
        self.assertTrue(privacy_icon.has_class('icon-eye-open'))
        
        structure = create_structure(self.document)
        root_path = self.document.get_root_path()
        dirs = fss.listdir(root_path)[0]
        files = fss.listdir(root_path)[1]
        for d in dirs:
            dir_path = os.path.join(root_path, d)
            for f in structure['dirs'][d]:
                self.assertIn(f, fss.listdir(dir_path)[1])
        for f in structure['files']:
            self.assertIn(f, fss.listdir(root_path)[1])
        
#        import time; time.sleep(3)
        self.browser.quit()
#    
#    def test_upload_doc_dropbox(self): #Create
#.........这里部分代码省略.........
开发者ID:CulturePlex,项目名称:festos,代码行数:103,代码来源:test_document.py


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