Best Python code snippet using SeleniumBase
test_runner.py
Source:test_runner.py
1import sys2import os3sys.path.append(sys.path[0] + "/...")4sys.path.append(os.getcwd())5from unittest import TestLoader, TestSuite, TextTestRunner6from Test.Scripts.test_demo_page import PHPTravelDemoHomePage7from Test.Scripts.test_authentication import AuthenticationAdminUser8from Test.Scripts.test_add_admin import AddNewAdmin9from Test.Scripts.test_edit_new_admin_permissions import EditNewAdmin10from Test.Scripts.test_login_with_new_admin import AuthenticationNewAdminUser11if __name__ == "__main__":12 13 test_loader = TestLoader()14 test_suite = TestSuite((15 #test_loader.loadTestsFromTestCase(PHPTravelDemoHomePage),16 test_loader.loadTestsFromTestCase(AuthenticationAdminUser),17 test_loader.loadTestsFromTestCase(AddNewAdmin),18 test_loader.loadTestsFromTestCase(EditNewAdmin),19 test_loader.loadTestsFromTestCase(AuthenticationNewAdminUser)20 ))21 22 test_runner = TextTestRunner(verbosity=2)...
test_demo_page.py
Source:test_demo_page.py
1from Src.test_base.web_driver_setup import WebDriverSetup2import unittest3from selenium import webdriver4class PHPTravelDemoHomePage(WebDriverSetup):5 def test_demo_page(self):6 self.driver.get('https://phptravels.com/demo/')7 self.driver.set_page_load_timeout(30)8 page_title = 'Demo Script Test drive - PHPTRAVELS'9 try:10 if self.driver.title == page_title:11 self.assertEqual(self.driver.title,page_title)12 print("Web page loaded successfully!")13 except Exception as error:14 print(error + "PHPTravel NOT LOADED")15if __name__ == '__main__':...
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!!