How to use quit_driver method in Selene

Best Python code snippet using selene_python

click_buttons_fill_inputs.py

Source:click_buttons_fill_inputs.py Github

copy

Full Screen

...9delay = 1010driver = webdriver.Chrome()11driver.set_window_size(678, 700)12driver.get('https://techstepacademy.com/trial-of-the-stones')13def quit_driver(seconds=3):14 sleep(seconds)15 driver.quit()16def wait_until(_condition):17 WebDriverWait(driver, delay).until(_condition)18def activate_driver():19 try:20 driver.find_element_by_css_selector(21 'input[name="r1Input"]').send_keys('rock')22 driver.find_element_by_name('r1Btn').click()23 wait_until(EC.visibility_of_element_located((By.ID, 'passwordBanner')))24 pwd = driver.find_element_by_xpath(25 '//div[@id="passwordBanner"]/h4').text26 driver.find_element_by_name('r2Input').send_keys(pwd)27 driver.find_element_by_name('r2Butn').click()28 wait_until(EC.visibility_of_element_located((By.ID, 'successBanner1')))29 msg = driver.find_element_by_xpath('//div[@id="successBanner1"]/h4')30 assert msg.text == 'Success!'31 32 names = [33 s.text for s in driver.find_elements_by_xpath('//div/span')]34 wealth = [int(n.text)35 for n in driver.find_elements_by_xpath('//div/span/../p')]36 max_amt = reduce(lambda a, b: a if a > b else b, wealth)37 for n, w in zip(names, wealth):38 if w == max_amt:39 driver.find_element_by_id('r3Input').send_keys(n)40 driver.find_element_by_id('r3Butn').click()41 break42 wait_until(EC.visibility_of_element_located(43 (By.ID, 'successBanner2')))44 msg2 = driver.find_element_by_id('successBanner2')45 assert msg2.text == 'Success!'46 driver.find_element_by_id('checkButn').click()47 wait_until(EC.visibility_of_element_located(48 (By.ID, 'trialCompleteBanner')))49 msg3 = driver.find_element_by_xpath(50 '//div[@id="trialCompleteBanner"]/h4')51 assert msg3.text == 'Trial Complete'52 53 print("Mission accomplished soulja")54 quit_driver(5)55 56 except err.NoSuchElementException:57 print('Did not find element you were looking for.')58 quit_driver()59 except err.TimeoutException:60 print('Loading took too much time')61 quit_driver()...

Full Screen

Full Screen

driver.py

Source:driver.py Github

copy

Full Screen

...26# _driver.set_window_size(1920, 1080)27#28# config.driver = _driver29#30# def quit_driver():31# _driver.quit()32#33# request.addfinalizer(quit_driver)34#35# _driver.implicitly_wait(10)36# _driver.get(config.base_url)37#38# return _driver39@pytest.fixture(scope='session')40def session_driver(request):41 _driver = get_driver(config.browser)42 # _driver.maximize_window()43 _driver.set_window_position(0, 0)44 _driver.set_window_size(1440, 1000)45 config.driver = _driver46 def quit_driver():47 _driver.quit()48 request.addfinalizer(quit_driver)...

Full Screen

Full Screen

conftest.py

Source:conftest.py Github

copy

Full Screen

...14 set_driver(webdriver.Chrome(ChromeDriverManager().install()))15 open_url(XKCD_URL)16 home_page = HomePage()17 yield home_page18 quit_driver()19@pytest.fixture20def kicherchekoi_home_page():21 set_driver(webdriver.Chrome(ChromeDriverManager().install()))22 open_url(KICHERCHEKOI_URL)23 home_page = KicherchekoiHomePage()24 yield home_page25 quit_driver()26@pytest.fixture27def trainline_home_page(browser):28 home_page = TrainlineHomePage()29 return home_page30@pytest.fixture31def trainline_train_details_page(browser):32 result_page = TrainlineSearchResultPage()33 return result_page34@pytest.fixture35def browser():36 set_driver(webdriver.Chrome(ChromeDriverManager().install()))37 open_url(TRAINLINE_URL)38 yield driver()...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Selene automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful