How to use test_click_button method in toolium

Best Python code snippet using toolium_python

elements_test.py

Source:elements_test.py Github

copy

Full Screen

1import random2import time3from pages.element_page import TextBoxPage, CheckBoxPage, CheckRadioButton, CheckWebTable, CheckClickButton, \4 CheckClickLinksCl, UploadDownloadPage, DinamicPrpetiesPage5class TestElements:6 class TestTextBox:7 def test_text_box(self, driver):8 text_box_page = TextBoxPage(driver, "https://demoqa.com/text-box")9 text_box_page.open()10 full_name, email, current_address, permanent_address = text_box_page.fill_all_fields()11 print(full_name,email, current_address, permanent_address)12 output_name, output_email, output_cur_addr, output_per_addr = text_box_page.check_filled_form()13 assert full_name == output_name14 assert email == output_email15 assert current_address == output_cur_addr16 assert permanent_address == output_per_addr17 class TestCheckBox:18 def test_check_box(self, driver):19 check_box_page = CheckBoxPage(driver, "https://demoqa.com/checkbox")20 check_box_page.open()21 check_box_page.open_full_list()22 check_box_page.click_random_check_box()23 input_check_box = check_box_page.get_checked_checkboxes()24 output_result = check_box_page.get_output_results()25 assert input_check_box == output_result26 class TestRadioButton:27 def test_check_radio_button(self, driver):28 check_radioButton_page = CheckRadioButton(driver, "https://demoqa.com/radio-button")29 check_radioButton_page.open()30 check_radioButton_page.click_on_the_radio_button('yes')31 output_yes = check_radioButton_page.get_output_result()32 check_radioButton_page.click_on_the_radio_button('impressive')33 output_no = check_radioButton_page.get_output_result()34 check_radioButton_page.click_on_the_radio_button('no')35 output_impression = check_radioButton_page.get_output_result()36 assert output_yes == "Yes"37 assert output_impression == "Impressive"38 assert output_no == "No"39 class TestWebTable:40 def test_web_table_add_person(self, driver):41 check_web_table_page = CheckWebTable(driver, "https://demoqa.com/webtables")42 check_web_table_page.open()43 new_person = check_web_table_page.add_new_person()44 table_result = check_web_table_page.check_add_person()45 assert new_person in table_result46 def test_web_table_search_person(self, driver):47 check_web_table_page = CheckWebTable(driver, "https://demoqa.com/webtables")48 check_web_table_page.open()49 key_word = check_web_table_page.add_new_person()[random.randint(0, 5)]50 print(key_word)51 time.sleep(1)52 check_web_table_page.search_some_person(key_word)53 table_result = check_web_table_page.check_search_person()54 print(table_result)55 assert key_word in table_result56 def test_change_info(self, driver):57 check_web_table_page = CheckWebTable(driver, "https://demoqa.com/webtables")58 check_web_table_page.open()59 last_name = check_web_table_page.add_new_person()[1]60 check_web_table_page.search_some_person(last_name)61 age = check_web_table_page.update_person_info()62 row = check_web_table_page.check_search_person()63 assert age in row64 def test_delete_person(self, driver):65 check_web_table_page = CheckWebTable(driver, "https://demoqa.com/webtables")66 check_web_table_page.open()67 email = check_web_table_page.add_new_person()[3]68 check_web_table_page.search_some_person(email)69 check_web_table_page.del_person()70 text = check_web_table_page.check_deleted()71 assert text == "No rows found"72 def test_change_count_row(self, driver):73 check_web_table_page = CheckWebTable(driver, "https://demoqa.com/webtables")74 check_web_table_page.open()75 count = check_web_table_page.select_up_to_some_rows()76 assert count == [5, 10, 20, 25, 50, 100]77 class TestClickButtons:78 def test_click(self, driver):79 test_click_button = CheckClickButton(driver, "https://demoqa.com/buttons")80 test_click_button.open()81 test_click_button.double_click_button()82 test_click_button.right_click_button()83 test_click_button.click_button()84 output_result = test_click_button.check_result()85 assert "You have done a double click" in output_result, "Don't work double click"86 assert "You have done a right click" in output_result, "Don't work right-click button"87 assert "You have done a dynamic click" in output_result, "Don't work click button"88 class TestLinks:89 def test_link_opened_new_tab(self, driver):90 test_click_link = CheckClickLinksCl(driver, "https://demoqa.com/links")91 test_click_link.open()92 output_list = test_click_link.check_links()93 assert "https://demoqa.com/" == output_list[0]94 assert "https://demoqa.com/" == output_list[1]95 def test_check_api_links(self, driver):96 test_click_link = CheckClickLinksCl(driver, "https://demoqa.com/links")97 test_click_link.open()98 response_code = test_click_link.check_links_api(url="https://demoqa.com/bad-request")99 assert response_code == 400100 response_code = test_click_link.check_links_api(url="https://demoqa.com/Moved")101 assert response_code == 301102 response_code = test_click_link.check_links_api(url="https://demoqa.com/no-content")103 assert response_code == 204104 response_code = test_click_link.check_links_api(url="https://demoqa.com/Unauthorized")105 assert response_code == 401106 response_code = test_click_link.check_links_api(url="https://demoqa.com/Forbidden")107 assert response_code == 403108 # не смог подобрать адресс109 # response_code = test_click_link.check_links_api(url="https://demoqa.com/Not-Found")110 # assert response_code == 404111 class TestUploadDownloadPage:112 def test_upload_file(self, driver):113 upload_download_page = UploadDownloadPage(driver, "https://demoqa.com/upload-download")114 upload_download_page.open()115 file_name, result = upload_download_page.upload_file()116 assert file_name == result, "The file is not uploaded"117 def test_download_file(self, driver):118 upload_download_page = UploadDownloadPage(driver, "https://demoqa.com/upload-download")119 upload_download_page.open()120 check_file = upload_download_page.download_file()121 assert check_file is True, "The file is not downloaded"122 class TestDinamicProperties:123 def test_check_enable_button(self, driver):124 dinamic_properties_page = DinamicPrpetiesPage(driver=driver, url="https://demoqa.com/")125 dinamic_properties_page.open()126 dinamic_properties_page.open_search_page()127 enable_button = dinamic_properties_page.check_enable_button()128 print(enable_button)129 assert enable_button == True130 def test_dinamic_properties(self, driver):131 dinamic_properties_page = DinamicPrpetiesPage(driver=driver, url="https://demoqa.com/")132 dinamic_properties_page.open()133 dinamic_properties_page.open_search_page()134 color_after, color_before = dinamic_properties_page.check_changed_color()135 assert color_before != color_after136 def test_appear_of_button(self, driver):137 dinamic_properties_page = DinamicPrpetiesPage(driver=driver, url="https://demoqa.com/")138 dinamic_properties_page.open()139 dinamic_properties_page.open_search_page()140 appear = dinamic_properties_page.check_appear_of_button()141 print(appear)...

Full Screen

Full Screen

test_buttons_sub_tub.py

Source:test_buttons_sub_tub.py Github

copy

Full Screen

...3from ...test_data.constants import MAIN_PAGE_LINK4from ...pages.elements_page.buttons_sub_tub import ButtonsSubTub5LOGGER = logging.getLogger()6@scenario('elements_page/buttons_sub_tub.feature', "Click on Click Me button")7def test_click_button():8 LOGGER.info("test_click_button")9 pass10@given("I'm on Elements page")11def open_elements_page(browser):12 LOGGER.info("open_elements_page")13 page = ButtonsSubTub(browser, MAIN_PAGE_LINK)14 page.open()15 page.go_to_elements_page()16@given("I'm on Buttons sub-tab")17def open_buttons_sub_tub(browser):18 LOGGER.info("open_buttons_sub_tub")19 current_page_url = browser.current_url20 ButtonsSubTub(browser, current_page_url).go_to_buttons_sub_tub()21@when("I click on Click Me button")...

Full Screen

Full Screen

login_test.py

Source:login_test.py Github

copy

Full Screen

...11fail_url = 'https://www.hudl.com/login'12test_pass = os.getenv('PASSWORD')13test_email = os.getenv('USERNAME')14# Tests for proper result when Login button is clicked15def test_click_button(name,password,expectedurl):16 browser.get(url)17 email_input = browser.find_element_by_id('email')18 password_input = browser.find_element_by_id('password')19 login_button = browser.find_element_by_id('logIn')20 email_input.send_keys(name)21 password_input.send_keys(password)22 login_button.click()23 WebDriverWait(browser, 7).until(expected.url_to_be(expectedurl))24 assert browser.title == expectedurl25# Tests for proper result when enter key is typed26def test_enter(name,password,expectedurl):27 browser.get(url)28 email_input = browser.find_element_by_id('email')29 password_input = browser.find_element_by_id('password')30 email_input.send_keys(name)31 password_input.send_keys(password)32 password_input.send_keys(Keys.RETURN)33 WebDriverWait(browser, 7).until(expected.url_to_be(expectedurl))34 assert browser.title == expectedurl35#Test Function Call:36test_click_button(test_email,test_pass,pass_url)37test_click_button(test_email,'Blue237!',fail_url)38test_click_button('gary123@gmail.com',test_pass,fail_url)39#Pass40test_enter(test_email,test_pass,pass_url)41test_enter(test_email,'Yellow1!',fail_url)42test_enter('tim123@yahoo.com',test_pass,fail_url)...

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 toolium 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