Best Python code snippet using SeleniumBase
test_homeIndexPage.py
Source:test_homeIndexPage.py
...34 35 def test_01_login(self):36 '''ç»å½ç³»ç»'''37 loginGo(self.dr).click_login()38 self.assertEqual('è¡ä¸ä¿¡æ¯æ¦è§' ,self.page.get_page_title(),'ç»å½å¤±è´¥')39 @unittest.Myskip40 def test_998_option_link(self):41 '''æµè¯ä¿®æ¹å¯ç é¾æ¥åè½'''42 self.page.go_modify_password()43 self.assertEqual('ä¿®æ¹å¯ç ' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')44 45 @unittest.Myskip46 def test_999_option_link(self):47 '''æµè¯éåºç³»ç»åè½'''48 self.page.go_login_out()49 self.assertIn('ç»å½' ,self.page.get_page_title(),'éåºç³»ç»å¤±è´¥')50 @unittest.Myskip51 def test_02_option_link(self):52 '''æµè¯è¡ä¸æ¥è¯¢é¾æ¥åè½'''53 self.page.go_HYCX()54 self.assertEqual('è¡ä¸æ¥è¯¢' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')55 56 @unittest.Myskip57 def test_03_option_link(self):58 '''æµè¯ç´§æ¥æ
åµä¿å®è°å¨é¾æ¥åè½'''59 self.page.go_JJQKBADD()60 self.dr.waitSleep(2)61 self.assertEqual('ç´§æ¥æ
åµä¿å®è°å¨' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')62 @unittest.Myskip 63 def test_04_option_link(self):64 '''æµè¯è¦ä¿èå¨åå²è®°å½é¾æ¥åè½'''65 self.page.go_JBLDLSJL()66 self.assertEqual('è¦ä¿èå¨åå²è®°å½' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')67 @unittest.Myskip68 def test_05_option_link(self):69 '''æµè¯ä¿å®è¡ä¸ç»è®¡é¾æ¥åè½'''70 self.page.go_BAHYTJ()71 self.assertEqual('ä¿å®è¡ä¸ç»è®¡' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')72 @unittest.Myskip73 def test_06_option_link(self):74 '''æµè¯åä½æ°å¢é¾æ¥åè½'''75 self.page.go_DWXZ()76 self.assertEqual('æ°å¢åä½å¤æ¡' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')77 @unittest.Myskip78 def test_07_option_link(self):79 '''æµè¯åä½ä¿®æ¹é¾æ¥åè½'''80 self.page.go_DWXG()81 self.assertEqual('åä½å¤æ¡åæ´' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')82 @unittest.Myskip83 def test_08_option_link(self):84 '''æµè¯åä½æ³¨éé¾æ¥åè½'''85 self.page.go_DWZX()86 self.assertEqual('åä½å¤æ¡æ³¨é' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')87 @unittest.Myskip88 def test_09_option_link(self):89 '''æµè¯äººåæ¥è¯¢é¾æ¥åè½'''90 self.page.go_RYCX()91 self.assertEqual('人åæ¥è¯¢' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')92 @unittest.Myskip93 def test_10_option_link(self):94 '''æµè¯äººåæ°å¢é¾æ¥åè½'''95 self.page.go_RYXZ()96 self.assertEqual('人åæ°å¢' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')97 98 @unittest.Myskip99 def test_11_option_link(self):100 '''æµè¯äººåä¿®æ¹é¾æ¥åè½'''101 self.page.go_RYXG()102 self.assertEqual('人åä¿®æ¹' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')103 @unittest.Myskip104 def test_12_option_link(self):105 '''æµè¯äººå注éé¾æ¥åè½'''106 self.page.go_RYZX()107 self.assertEqual('人å注é' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')108 @unittest.Myskip109 def test_13_option_link(self):110 '''æµè¯åä½æ£æ¥é¾æ¥åè½'''111 self.page.go_DWJC()112 self.assertEqual('åä½æ£æ¥' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')113 @unittest.Myskip114 def test_14_option_link(self):115 '''æµè¯åä½æ£æ¥ç»è®¡é¾æ¥åè½'''116 self.page.go_JCTJ()117 self.assertEqual('åä½æ£æ¥ç»è®¡' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')118 @unittest.Myskip119 def test_15_option_link(self):120 '''æµè¯å
¨è¦æ
æ¥æ£ç´¢é¾æ¥åè½'''121 self.page.go_QJQBJS()122 self.assertEqual('å
¨è¦æ
æ¥æ£ç´¢' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')123 @unittest.Myskip124 def test_16_option_link(self):125 '''æµè¯æ¥è¦æ¥è¯¢é¾æ¥åè½'''126 self.page.go_BJCX()127 self.assertEqual('æ¥è¦æ¥è¯¢' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')128 @unittest.Myskip129 def test_17_option_link(self):130 '''æµè¯åºæè§é¢çæ§é¾æ¥åè½'''131 self.page.go_CSSPJK()132 self.assertEqual('åºæè§é¢çæ§' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')133 @unittest.Myskip134 def test_18_option_link(self):135 '''æµè¯åºæè§é¢åæ¾é¾æ¥åè½'''136 self.page.go_CSSPHF()137 self.assertEqual('åºæè§é¢åæ¾' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')138 @unittest.Myskip139 def test_19_option_link(self):140 '''æµè¯æ¶æ¯åå¸é¾æ¥åè½'''141 self.page.go_XXFB()142 self.assertEqual('æ¶æ¯åå¸' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')143 @unittest.Myskip144 def test_20_option_link(self):145 '''æµè¯åå¸åå²æ¥è¯¢é¾æ¥åè½'''146 self.page.go_FBLSCX()147 self.assertEqual('ä¿¡æ¯åå¸åå²æ¥è¯¢' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')148 @unittest.Myskip149 def test_21_option_link(self):150 '''æµè¯æºæ管çé¾æ¥åè½'''151 self.page.go_JGGL()152 self.assertEqual('æºæ管ç' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')153 @unittest.Myskip154 def test_22_option_link(self):155 '''æµè¯ç¨æ·ç®¡çé¾æ¥åè½'''156 self.page.go_YHGL()157 self.assertEqual('ç¨æ·ç®¡ç' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')158 @unittest.Myskip159 def test_23_option_link(self):160 '''æµè¯ç¨æ·ç»ç®¡çé¾æ¥åè½'''161 self.page.go_YHZGL()162 self.assertEqual('ç¨æ·ç»ç®¡ç' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')163 @unittest.Myskip164 def test_24_option_link(self):165 '''æµè¯ç¨æ·åç»ç®¡çé¾æ¥åè½'''166 self.page.go_YHFZGL()167 self.assertEqual('ç¨æ·åç»ç®¡ç' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')168 @unittest.Myskip169 def test_25_option_link(self):170 '''æµè¯æå表设置é¾æ¥åè½'''171 self.page.go_DFBSZ()172 self.assertEqual('æå表管ç' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')173 @unittest.Myskip174 def test_26_option_link(self):175 '''æµè¯æ°æ®åå
¸é¾æ¥åè½'''176 self.page.go_SJZD()177 self.assertEqual('æ°æ®åå
¸' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')178 @unittest.Myskip179 def test_27_option_link(self):180 '''æµè¯åæ°è®¾ç½®é¾æ¥åè½'''181 self.page.go_CSSZ()182 self.assertEqual('åæ°è®¾ç½®' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')183 @unittest.Myskip184 def test_28_option_link(self):185 '''æµè¯æ©å±æ°æ®å段é¾æ¥åè½'''186 self.page.go_KZSJZD()187 self.assertEqual('æ©å±æ°æ®å段' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')188 @unittest.Myskip189 def test_29_option_link(self):190 '''æµè¯å·¥ä½æ¥å¿é¾æ¥åè½'''191 self.page.go_workLog()192 self.assertEqual('å·¥ä½æ¥å¿' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')193 @unittest.Myskip194 def test_30_option_link(self):195 '''æµè¯æä½æ¥å¿é¾æ¥åè½'''196 self.page.go_operationLog()197 self.assertEqual('æä½æ¥å¿' ,self.page.get_page_title(),'页é¢æ é¢ä¸ä¸è´')198 199 200if __name__ == '__main__':201 unittest.main()202 ...
test_navbar.py
Source:test_navbar.py
...22 else:23 navbar.click_work_tab()24 time.sleep(3)25 assert self.get_current_url() == "https://www.rixxo.com/work"26 assert self.get_page_title() == "Our Work | Want To Learn More? 0117 2077504"27 # /clients28 navbar.click_clients_tab()29 time.sleep(3)30 assert self.get_current_url() == "https://www.rixxo.com/clients/"31 assert self.get_page_title() == "Our Clients | Like What You See? What To Join In?"32 # /services33 self.action.move_to_element(navbar.get_services_tab()).pause(8).click().perform()34 time.sleep(3)35 assert self.get_current_url() == "https://www.rixxo.com/services/"36 assert self.get_page_title() == "B2B ECommerce & Marketing Services For Strategic Growth"37 # /blog38 navbar.click_blog_tab()39 time.sleep(3)40 assert self.get_current_url() == "https://www.rixxo.com/blog/"41 assert self.get_page_title() == "Blog | Rixxo | B2B Magento Marketing Specialists"42 # /about43 navbar.click_about_us_tab()44 time.sleep(3)45 assert self.get_current_url() == "https://www.rixxo.com/about/"46 assert self.get_page_title() == "About Rixxo | We Are An Agency Redefining Audience Engagement"47 # contact48 navbar.click_contact_tab()49 time.sleep(3)50 assert self.get_current_url() == "https://www.rixxo.com/contact/"51 assert self.get_page_title() == "Contact Rixxo | An Agency Redefining Audience Engagement"52 # Pages tests53 # Maybe parametrize these tests?54 # create fixture request to switch between desktop, tablet, phone window sizes55 def test_work_tab(self):56 self.driver.get("https://www.rixxo.com")57 navbar = Navbar(self.driver)58 navbar.click_work_tab()59 time.sleep(3)60 assert self.get_current_url() == "https://www.rixxo.com/work"61 assert self.get_page_title() == "Our Work | Want To Learn More? 0117 2077504"62 def test_clients_tab(self):63 self.driver.get("https://www.rixxo.com")64 navbar = Navbar(self.driver)65 navbar.click_clients_tab()66 time.sleep(3)67 assert self.get_current_url() == "https://www.rixxo.com/clients/"68 assert self.get_page_title() == "Our Clients | Like What You See? What To Join In?"69 def test_services_tab(self):70 self.driver.get("https://www.rixxo.com")71 navbar = Navbar(self.driver)72 self.action.move_to_element(navbar.get_services_tab()).pause(6).click().perform()73 time.sleep(3)74 assert self.get_current_url() == "https://www.rixxo.com/services/"75 assert self.get_page_title() == "B2B ECommerce & Marketing Services For Strategic Growth"76 def test_services_tab_hover(self):77 self.driver.get("https://www.rixxo.com")78 navbar = Navbar(self.driver)79 self.action.move_to_element(navbar.get_services_tab()).pause(5).perform()80 navbar.get_services_submenu()81 assert (ec.visibility_of(navbar.get_services_submenu()))82 def test_blog_tab(self):83 self.driver.get("https://www.rixxo.com")84 navbar = Navbar(self.driver)85 navbar.click_blog_tab()86 time.sleep(3)87 assert self.get_current_url() == "https://www.rixxo.com/blog/"88 assert self.get_page_title() == "Blog | Rixxo | B2B Magento Marketing Specialists"89 def test_about_us_tab(self):90 self.driver.get("https://www.rixxo.com")91 navbar = Navbar(self.driver)92 navbar.click_about_us_tab()93 time.sleep(3)94 assert self.get_current_url() == "https://www.rixxo.com/about/"95 assert self.get_page_title() == "About Rixxo | We Are An Agency Redefining Audience Engagement"96 def test_contact_tab(self):97 self.driver.get("https://www.rixxo.com")98 navbar = Navbar(self.driver)99 navbar.click_contact_tab()100 time.sleep(3)101 assert self.get_current_url() == "https://www.rixxo.com/contact/"102 assert self.get_page_title() == "Contact Rixxo | An Agency Redefining Audience Engagement"103 @pytest.fixture(params=["desktop", "tablet", "mobile"])104 def define_window_size(self, request):...
test_HomeBtn.py
Source:test_HomeBtn.py
...4class TestHomeBtn(BaseTest):5 def test_service_link(self):6 self.linksButtons = LinksButtons(self.driver)7 self.linksButtons.service_link("services")8 service_title = self.linksButtons.get_page_title(TestData.SERVICE_TITLE)9 assert service_title == self.linksButtons.get_page_title(TestData.SERVICE_TITLE)10 self.linksButtons.home_btn()11 home_title = self.linksButtons.get_page_title(TestData.HOME_PAGE_TITLE)12 assert home_title == TestData.HOME_PAGE_TITLE13 def test_isg_future_of_work(self):14 self.linksButtons = LinksButtons(self.driver)15 self.linksButtons.isg_future_of_work("isg future of work")16 isg_title = self.linksButtons.get_page_title(TestData.FUTURE_OF_WORK_TITLE)17 assert isg_title == self.linksButtons.get_page_title(TestData.FUTURE_OF_WORK_TITLE)18 self.linksButtons.home_btn()19 home_title = self.linksButtons.get_page_title(TestData.HOME_PAGE_TITLE)20 assert home_title == TestData.HOME_PAGE_TITLE21 def test_industries_link(self):22 self.linksButtons = LinksButtons(self.driver)23 self.linksButtons.industries_link("industries")24 industries_title = self.linksButtons.get_page_title(TestData.INDUSTRIES_TITLE)25 assert industries_title == self.linksButtons.get_page_title(TestData.INDUSTRIES_TITLE)26 self.linksButtons.home_btn()27 home_title = self.linksButtons.get_page_title(TestData.HOME_PAGE_TITLE)28 assert home_title == TestData.HOME_PAGE_TITLE29 def test_all_news_link(self):30 self.linksButtons = LinksButtons(self.driver)31 self.linksButtons.all_news("all news")32 all_news_title = self.linksButtons.get_page_title(TestData.ALL_NEWS_TITLE)33 assert all_news_title == self.linksButtons.get_page_title(TestData.ALL_NEWS_TITLE)34 self.linksButtons.home_btn()35 home_title = self.linksButtons.get_page_title(TestData.HOME_PAGE_TITLE)36 assert home_title == TestData.HOME_PAGE_TITLE37 def test_success_stories_link(self):38 self.linksButtons = LinksButtons(self.driver)39 self.linksButtons.success_stories("success stories")40 success_stories_title = self.linksButtons.get_page_title(TestData.SUCCESS_STORIES_TITLE)41 assert success_stories_title == self.linksButtons.get_page_title(TestData.SUCCESS_STORIES_TITLE)42 self.linksButtons.home_btn()43 home_title = self.linksButtons.get_page_title(TestData.HOME_PAGE_TITLE)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!