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


Python mslib.wait_for_element_present函数代码示例

本文整理汇总了Python中mslib.wait_for_element_present函数的典型用法代码示例。如果您正苦于以下问题:Python wait_for_element_present函数的具体用法?Python wait_for_element_present怎么用?Python wait_for_element_present使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: starter_dialog_translate_from_not_orig

def starter_dialog_translate_from_not_orig(self,sel,from_lang,to_lang='hr'):
    """Choose the a new translation and translate from a sub that is not the orig lang.
    Return from_lang

    This assumes you know the original language and want to edit the original subs.

    Post-condition: the widget is launched and you will be on step 1 or Edit step
    """
    #Figure out orig lang fail is there isn't a set lang already
    mslib.wait_for_text_present(self,sel,"This video")
    if sel.is_element_present(testvars.create_lang_unknown):
        self.fail("can't make a new translation when video has no orig lang set - test is invalid")
    else:
        ol = sel.get_text(testvars.create_lang_known)
        orig_lang = ol.split("in ")[1]
        lc = sel.get_value("css=select.to-language option:contains('"+orig_lang+" ')")
        lang_code = re.sub("\d+$","",lc)
    if lang_code == from_lang:
        self.fail("invalid test - from lang "+str(from_lang)+" is the same as the origi lang"+str(orig_lang))
        
    select_video_language(self,sel,sub_lang=to_lang,from_lang=from_lang)
    time.sleep(5)
    close_howto_video(self,sel)
    mslib.wait_for_element_present(self,sel,"css=.unisubs-help-heading")
    return from_lang
开发者ID:pculture,项目名称:unisubs-testing,代码行数:25,代码来源:widget.py

示例2: test_537

    def test_537(self):
        """Add comments on a translation using non-ascii characters
        
        http://litmus.pculture.org/show_test.cgi?id=537
        """
        
        sel = self.selenium
        sel.set_timeout(testvars.MSTestVariables["TimeOut"])
        #get a video and open page      
        website.SiteLogout(self,sel)
        test_video_url = website.get_video_with_translations(self,sel)
        print test_video_url
        sel.open(test_video_url)
        language = website.get_translated_lang(self,sel)
        
        
        #Login and go to language comments page
        website.SiteLogIn(self,sel,testvars.siteuser,testvars.passw)
        sel.open(test_video_url)
        mslib.wait_for_element_present(self,sel,testvars.video_lang+":contains('"+language+"')")
        sel.click(testvars.video_lang+":contains('"+language+"')")
        mslib.wait_for_element_present(self,sel,testvars.video_lang_hd+":contains('"+language+"')")
        sel.click(testvars.comments_tab) 

        #Enter some non-ascii comments
        print "1. entering croatian comment text"
        website.enter_comment_text(self,sel,comments_text.hr_comment_text)
        website.verify_comment_text(self,sel,comments_text.hr_comment_text)
        print "2. entering japanese comment text"
        website.enter_comment_text(self,sel,comments_text.jp_comment_text)
        website.verify_comment_text(self,sel,comments_text.jp_comment_text)
        print "3. entering russian comment text"
        website.enter_comment_text(self,sel,comments_text.ru_comment_text)
        website.verify_comment_text(self,sel,comments_text.ru_comment_text)
开发者ID:pculture,项目名称:unisubs-testing,代码行数:34,代码来源:sg_80_comments.py

示例3: SiteLogout

def SiteLogout(self,sel):
    """
    Description: Logout of site using site Logout button.

    """
    sel.open("/logout/?next=/")
    mslib.wait_for_element_present(self,sel,testvars.WebsiteUI["Login_Button"])
开发者ID:pculture,项目名称:unisubs-testing,代码行数:7,代码来源:website.py

示例4: Login

def Login(self,sel,auth_type):
    """
    Description: Log on using website button and select an external login option.
    auth_type can be either 'twitter', 'open-id', or 'google'

    Requires: valid account for selected login.  See testvars for existing accounts.

    Pre-condition: user is on the site page
    
    Post-condition: offsite login form displayed, see offsite
    
    
    """
    # auth_type can be either ".twitter", ".open-id", "google"
    if auth_type == "twitter":
        auth_link = "css=a#twitter.provider"
    elif auth_type == "open-id":
        auth_link = "css=a#open-id.provider"
    elif auth_type == "google":
        auth_link = "css=a#google.provider"
    else:
        self.fail("unrecognized auth type")
    sel.select_window("null")
    mslib.wait_for_element_present(self,sel,testvars.WebsiteUI["Login_Button"])
    sel.click(testvars.WebsiteUI["Login_Button"])
    mslib.wait_for_element_present(self,sel,auth_link)
    sel.click(auth_link)
    sel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"])
开发者ID:pculture,项目名称:unisubs-testing,代码行数:28,代码来源:website.py

示例5: edit_translation

def edit_translation(self,sel,subtextfile,new_text=""):
    """
    Description: Update the translation text with either the orig text or text provided in a file.

    Options:
        new_text - text string

    Pre-condition - Editing Translation Widget opened
    """
    print ("Editing the translation")
    sel.select_window("null")
    mslib.wait_for_element_present(self,sel,"css=.unisubs-titlesList")
    for i,line in enumerate(codecs.open(subtextfile)):
        x = i+1
        sub_cell = "css=.unisubs-titlesList li:nth-child("+str(x)+")"
        if sel.is_element_present(sub_cell) == False:
            break
        thetextarea = "css=textarea"
        if new_text == "":
            ed_text = str(line).upper()
        else:
            ed_text = new_text
        sel.click(sub_cell)
        sel.type(thetextarea, u'ed_text')
        sel.get_eval("this.browserbot.getUserWindow().unisubs.widget.fireKeySequence(this.browserbot.getUserWindow().document.getElementsByClassName('unisubs-subedit')[0], 13,13);") 
        time.sleep(1)
    sel.click(testvars.WidgetUI["Next_step"])
开发者ID:pculture,项目名称:unisubs-testing,代码行数:27,代码来源:widget.py

示例6: starter_dialog_translate_from_orig

def starter_dialog_translate_from_orig(self,sel,to_lang='hr'):
    """Choose the a new translation and translate from original lang
    Return orig_lang

    This assumes you know the original language and want to edit the original subs.

    Post-condition: the widget is launched and you will be on step 1 or Edit step
    """
    #Figure out orig lang fail is there isn't a set lang already
    mslib.wait_for_text_present(self,sel,"This video")
    sel.select_frame("relative=top")
    if sel.is_element_present(testvars.create_lang_unknown):
        self.fail("can't make a new translation when video has no orig lang set - test is invalid")
    else:
        time.sleep(5)
        ol = sel.get_text(testvars.create_lang_known)
        orig_lang = ol.split("in ")[1]
        if not sel.is_element_present("css=select.from-language option:contains('"+orig_lang+" ')"):
            print "orig lang not transcribed - choosing other existing lang"
            lc = sel.get_value("css=select.from-language option")
        else:
            lc = sel.get_value("css=select.from-language option:contains('"+orig_lang+" ')")
        lang_code = re.sub("\d+$","",lc) #gives only the letters of the value field.
        from_code = re.sub("\D","",lc)  #gives only the number - used in from pulldown.
        select_video_language(self,sel,sub_lang=to_lang,from_lang=from_code)
        time.sleep(5)
        close_howto_video(self,sel)
        mslib.wait_for_element_present(self,sel,"css=div.unisubs-help-heading")
        return orig_lang
开发者ID:pculture,项目名称:unisubs-testing,代码行数:29,代码来源:widget.py

示例7: test_691

 def test_691(self):
     """Pagedemo New York Times video 1 - forked the subs and create a fresh set of captions in hr lang.
     
     http://litmus.pculture.org/show_test.cgi?id=691
     """
     test_id = 691
     sel = self.selenium
     testpage = "/pagedemo/nytimes_youtube_embed"
     subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"],"OctopusGarden.txt")
     sel.open(testpage)
     sel.wait_for_page_to_load(testvars.timeout)
     sel.window_maximize()
     mslib.wait_for_element_present(self,sel,testvars.WebsiteUI["SubtitleMe_menu"])
     time.sleep(5)
     sel.get_eval('this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[0].openMenu()')
     widget.open_starter_dialog(self,sel)
     widget.starter_dialog_fork(self,sel,to_lang='hr')
     widget.transcribe_video(self, sel, subtextfile)
     widget.sync_video(self, sel, subtextfile)
     widget.site_login_from_widget_link(self,sel)
     #verify subs still present
     print "verifying subtitles are still present"
     sel.select_window("null")
     mslib.wait_for_element_present(self,sel,"css=.unisubs-titlesList")
     widget.verify_sub_text(self,sel,subtextfile)
     if sel.is_element_present("css=.unisubs-modal-login"): #Login
         sel.click("css=.unisubs-log")
         widget.site_login_auth(self,sel)
         sel.select_window("null")
     widget.submit_sub_edits(self,sel,offsite=True)
开发者ID:pculture,项目名称:unisubs-testing,代码行数:30,代码来源:sg_78_widget_pagedemo.py

示例8: test_741

 def test_741(self):
     """widgetizer on MC site html5 mp4.
     http://litmus.pculture.org/show_test.cgi?id=741
     Video with widget embedded on Miro Community test page.
     """
     print self.shortDescription()
     sel = self.selenium
     mc_page = "widgetizer_tests"
     test_page = selvars.set_unisubs_mc_page(self,mc_page)
     sel.open(test_page)
     sel.wait_for_page_to_load(testvars.timeout)
     mslib.wait_for_element_present(self, sel,"body#video_page div.unisubs-videoTab:nth-child(2) >  a.unisubs-subtitleMeLink span.unisubs-tabTextchoose")
     time.sleep(3)
     sel.get_eval('this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[1].openMenu()')
     time.sleep(2)
     if sel.is_element_present(testvars.WebsiteUI["AddSubtitles_menuitem"]) == True:
         print "has subtitles - edit and revert"
         subtextfile = "subs.txt"
         orig_rev = store_subs(self,sel)
         sel.open(test_page)
         sel.wait_for_page_to_load(testvars.timeout)
         mslib.wait_for_element_present(self,sel,testvars.WebsiteUI["SubtitleMe_menu"])
         time.sleep(3)
         sel.get_eval('this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[1].openMenu()')
         widget.starter_dialog_edit_orig(self,sel)
         edit_subs(self,sel,orig_rev,subtextfile)          
     else:
         make_new_subs(self,sel,subtextfile)
开发者ID:pculture,项目名称:unisubs-testing,代码行数:28,代码来源:sg_94_widgetizer.py

示例9: click_time_shift_arrows

def click_time_shift_arrows(self,sel,subtextfile):
    """
    Description: clicks the left and right arrows on subtitle text box.
    Verifies that the time has been changed by .05 seconds.

    Options:
        subtextfile - text used in transcribe step.
        
    """
    sub_li = 1
    sel.select_window("null")
    mslib.wait_for_element_present(self,sel,"css=.unisubs-activestep:contains('3')")
    mslib.wait_for_element_present(self,sel,testvars.WidgetUI["Sync_sub"])
    sub_cell_start_time = "css=li:nth-child("+str(sub_li)+") > .unisubs-timestamp span span.unisubs-timestamp-time"
    up_arrow = "css=li:nth-child("+str(sub_li)+") > .unisubs-timestamp span .unisubs-changeTime .unisubs-up"
    down_arrow = "css=li:nth-child("+str(sub_li)+") > .unisubs-timestamp span .unisubs-changeTime .unisubs-down"
    for x in range(0,3):  
        #Click up (right) and verify time jump of .05 seconds
        start_time = sel.get_text(sub_cell_start_time)
        sel.focus(up_arrow)
        sel.click_at(up_arrow,"")
        new_start_time = sel.get_text(sub_cell_start_time)
        self.assertAlmostEqual(mslib.calc_time_diff(start_time,new_start_time),float(.05),3)
        #maybe verify the pixel change on the timeline
    for x in range(0,3):
        #Click text-arrow right and verify time jump
        start_time = sel.get_text(sub_cell_start_time)
        sel.click_at(down_arrow,"")
        new_start_time = sel.get_text(sub_cell_start_time)
        self.assertAlmostEqual(mslib.calc_time_diff(new_start_time,start_time),float(.05),3)
开发者ID:pculture,项目名称:unisubs-testing,代码行数:30,代码来源:widget.py

示例10: test_689

    def test_689(self):
        """Pagedemo New York Times video 1 - edit original subs
        
        http://litmus.pculture.org/show_test.cgi?id=689
        """
        test_id = 689
        sel = self.selenium
        testpage = "/pagedemo/nytimes_youtube_embed"
        subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"],"OctopusGarden.txt")
        sel.open(testpage)
        sel.wait_for_page_to_load(testvars.timeout)
        sel.window_maximize()
        mslib.wait_for_element_present(self,sel,testvars.WebsiteUI["SubtitleMe_menu"])
        time.sleep(5)
        sel.get_eval('this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[0].openMenu()')
        widget.starter_dialog_edit_orig(self,sel)
        widget.goto_step(self,sel,step="2")
        widget.edit_text(self,sel,subtextfile)
        #Login

        if sel.is_element_present("css=div div.unisubs-needLogin a"):
            sel.click("css=div div.unisubs-needLogin a")
            mslib.wait_for_element_present(self,sel,"css=.unisubs-modal-login")
            sel.click("css=.unisubs-log")
            widget.site_login_auth(self,sel)
            sel.select_window("null")
        widget.submit_sub_edits(self,sel,offsite=True)
开发者ID:pculture,项目名称:unisubs-testing,代码行数:27,代码来源:sg_78_widget_pagedemo.py

示例11: test_623

 def test_623(self):
     """offsite widget on MC site.
     video url: http://www.youtube.com/watch?v=FNEImAIM4L4
     http://litmus.pculture.org/show_test.cgi?id=623
     Video with widget embedded on Miro Community test page.
     """
     mc_page = "hunter"
     vid_pos = "css=p.pElementTest span span.unisubs-widget div.unisubs-videoTab a span.unisubs-tabTextchoose"
     vid_title = "hunter.s.thompson.avi"
     print self.shortDescription()
     sel = self.selenium
     test_page = selvars.set_unisubs_mc_page(self, mc_page)
     sel.open(test_page)
     sel.wait_for_page_to_load(testvars.timeout)
     mslib.wait_for_element_present(self, sel, testvars.WebsiteUI["SubtitleMe_menu"])
     time.sleep(3)
     sel.get_eval("this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[0].openMenu()")
     time.sleep(2)
     if sel.is_element_present(testvars.WebsiteUI["AddSubtitles_menuitem"]) == True:
         print "has subtitles - edit and revert"
         subtextfile = "subs.txt"
         orig_rev = store_subs(self, sel)
         sel.open(test_page)
         sel.wait_for_page_to_load(testvars.timeout)
         mslib.wait_for_element_present(self, sel, testvars.WebsiteUI["SubtitleMe_menu"])
         time.sleep(3)
         sel.get_eval("this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[0].openMenu()")
         widget.starter_dialog_edit_orig(self, sel)
         edit_subs(self, sel, orig_rev, subtextfile)
     else:
         make_new_subs(self, sel, subtextfile)
开发者ID:pculture,项目名称:unisubs-testing,代码行数:31,代码来源:sg_78_widget_offsite.py

示例12: starter_dialog_edit_orig

def starter_dialog_edit_orig(self,sel):
    """Choose the current lang to edit.
    Return orig_lang

    Gets the videos orig lang to edit the original subs - or sets it to English if none set.

    Post-condition: the widget is launched and you will be on step 1.
    """
    
    #Figure our the original lang or choose your own
    orig_lang = "Original"
    time.sleep(5)
    if sel.is_element_present(testvars.WebsiteUI["AddSubtitles_menuitem"]):
        sel.click(testvars.WebsiteUI["AddSubtitles_menuitem"])
    time.sleep(15)
    if sel.is_element_present(testvars.create_lang_unknown): # No lang set, going to use English
        orig_lang = "English"
        select_video_language(self,sel,vid_lang='en',sub_lang='en')
    elif sel.is_element_present(testvars.create_lang_known):        
        ol = sel.get_text(testvars.create_lang_known)
        orig_lang = ol.split("in ")[1]
        print orig_lang
        lc = sel.get_value("css=select.to-language option:contains('"+orig_lang+"')")
        lang_code = re.sub("\d+$","",lc)
        select_video_language(self,sel,vid_lang=lang_code,sub_lang=lang_code)
    else:
        print "video opened directly - no lang select dialogs"
    time.sleep(10)
    close_howto_video(self,sel)
    mslib.wait_for_element_present(self,sel,"css=div.unisubs-help-heading")
    return orig_lang
开发者ID:pculture,项目名称:unisubs-testing,代码行数:31,代码来源:widget.py

示例13: test_737

    def test_737(self):
        """flowplayer offsite embed - subtitle and playback
 
        http://litmus.pculture.org/show_test.cgi?id=737
        Flowplayer with widget embedded on Miro Community test page.
        """
        mc_page = "embed_tests"
        vid_title = "flow player test"
        subtextfile = os.path.join(testvars.MSTestVariables["DataDirectory"], "737_flow.txt")
        print self.shortDescription()
        sel = self.selenium
        test_page = selvars.set_unisubs_mc_page(self, mc_page)
        sel.open(test_page)
        sel.wait_for_page_to_load(testvars.timeout)
        time.sleep(5)
        if sel.is_element_present(
            "css=p.other-flow div.unisubs-videoTab a.unisubs-subtitleMeLink span.unisubs-tabTextchoose:contains('Subtitle Me')"
        ):
            sel.click(
                "css=p.other-flow div.unisubs-videoTab a.unisubs-subtitleMeLink span.unisubs-tabTextchoose:contains('Subtitle Me')"
            )
        else:
            sel.get_eval("this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[5].openMenu()")
        make_new_subs(self, sel, subtextfile)
        # Playback Subs
        time.sleep(5)
        try:
            sel.get_eval("this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[5].play()")
            mslib.wait_for_element_present(self, sel, "css=p.other-flow span.unisubs-captionSpan")
            sel.get_eval("this.browserbot.getUserWindow().unisubs.widget.Widget.getAllWidgets()[5].pause()")
            caption_position = sel.get_element_height("css=p.other-flow span.unisubs-captionSpan")
            verify_caption_position(self, sel, caption_position)
        except:
            print "sub position playback failed"
            self.verificationErrors.append("sub playback / position test failed")
开发者ID:pculture,项目名称:unisubs-testing,代码行数:35,代码来源:sg_78_widget_offsite.py

示例14: back_step

def back_step(self,sel):
    """
    Description: Clicks the 'Back to' link to go back 1 step.
    """
    while sel.is_text_present("Back to Typing"):
        sel.click("link=Back to Typing")
        mslib.wait_for_element_present(self,sel,"css=.unisubs-activestep")
开发者ID:pculture,项目名称:unisubs-testing,代码行数:7,代码来源:widget.py

示例15: click_lang_tab

def click_lang_tab(self,sel,language):
    """Click on a lanugage tab.

    Assumes you are on the videos tab and know the lang you want.
    """
    mslib.wait_for_element_present(self,sel,testvars.video_lang+":contains('"+language+"')")
    sel.click(testvars.video_lang+":contains('"+language+"')")
    sel.wait_for_page_to_load(testvars.MSTestVariables["TimeOut"])
    self.failUnless(sel.is_element_present(testvars.video_lang_hd+":contains('"+language+"')"))
开发者ID:pculture,项目名称:unisubs-testing,代码行数:9,代码来源:website.py


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