github seleniumbase/SeleniumBase v1.47.2
Update message output from the SeleniumBase translator

latest releases: v4.32.11, v4.32.10, v4.32.9...
4 years ago

Update message output from the SeleniumBase translator

  • This only effects messages, and not the actual translations.
  • The error output is significantly improved.

Here are some examples of using the sbase translate ability on the command-line:

$ sbase translate basic_test.py --ko -p

 basic_test.py was translated to Korean! (Previous: English)

  ***  Here are the results:  >>> 
----------------------------------------------------------------
from seleniumbase.translate.korean import 셀레늄_테스트_케이스  
                                                                
                                                                
class MyTestClass(셀레늄_테스트_케이스):                        
                                                                
    def test_basic(self):                                       
        self.열기("https://store.xkcd.com/search")              
        self.입력('input[name="q"]', "xkcd book\n")             
        self.텍스트_확인("xkcd book", "div.results")            
        self.열기("https://xkcd.com/353/")                      
        self.클릭('a[rel="license"]')                           
        self.뒤로()                                             
        self.링크_텍스트를_클릭합니다("About")                  
        self.링크_텍스트를_클릭합니다("comic #249")             
        self.요소_확인('img[alt*="Chess"]')                     
----------------------------------------------------------------

Here's an example of attempting to translate a file that was already in the new language specified:

$ sbase translate basic_test.py --en -p

 basic_test.py was already in English!

  ***  No changes to display!  *** 

Here's an example of trying to translate a file that is missing the from seleniumbase import of a BaseCase in one of the ten currently-supported languages:

$ sbase translate boilerplates/boilerplate_test.py --fr -p

 * In order to translate the script,
 boilerplates/boilerplate_test.py requires "from seleniumbase..."
 and a BaseCase import in a supported language!

  ***  No changes to display!  *** 

Here's one more working example of a SeleniumBase translation:

$ sbase translate test_tinymce.py --ru -p

 test_tinymce.py was translated to Russian! (Previous: English)

  ***  Here are the results:  >>> 
-----------------------------------------------------------------------------------
import re                                                                          
from seleniumbase.translate.russian import ТестНаСелен                             
                                                                                   
                                                                                   
class MyTestClass(ТестНаСелен):                                                    
                                                                                   
    def click_menu_item(self, text):                                               
        self.спать(0.2)                                                            
        soup = self.get_beautiful_soup(self.получить_источник_страницы())          
        pattern = re.compile('%s' % text)                                          
        the_id = soup.find(text=pattern).parent.parent.attrs["id"]                 
        self.нажмите("#%s" % the_id)                                               
                                                                                   
    def test_base(self):                                                           
        self.открыть("https://seleniumbase.io/other/tinymce")                      
        self.ждать_элемента("div.mce-container-body")                              
        self.click_menu_item("File")                                               
        self.click_menu_item("New document")                                       
        self.click_menu_item("Paragraph")                                          
        self.click_menu_item("Heading 2")                                          
        self.переключиться_на_кадр("iframe#mce_1_ifr")                             
        self.добавить_текст("#tinymce", "Automate anything with SeleniumBase!\n")  
        self.переключиться_на_содержимое_по_умолчанию()                            
        self.нажмите('button i.mce-i-image')                                       
        self.введите('input[aria-label="Width"].mce-textbox', "300")               
        image_url = "https://seleniumbase.io/img/sb_logo_10.png"                   
        self.введите("input.mce-textbox", image_url + "\n")                        
        self.переключиться_на_кадр("iframe#mce_1_ifr")                             
        self.нажмите("h2")                                                         
        self.переключиться_на_содержимое_по_умолчанию()                            
        self.показать_сообщение("Automate anything with SeleniumBase!")            
        self.click_menu_item("File")                                               
        self.click_menu_item("Preview")                                            
        self.переключиться_на_кадр('iframe[sandbox="allow-scripts"]')              
        self.показать_сообщение("Learn SeleniumBase Today!")                       
-----------------------------------------------------------------------------------

Don't miss a new SeleniumBase release

NewReleases is sending notifications on new releases.