Best Python code snippet using lettuce_webdriver_python
client.py
Source:client.py
...63 def move_out_mouse_from_area_of_label(event):6465 self.info_label_object["fg"] = "black"6667 def click_on_label(event):6869 self.info_label_object.place_configure(relwidth=0.25)7071 self.info_label_object["text"] = "The Username field will be shown\nas the nickname in the chat room"7273 self.info_label_object.bind("<Button-1>",click_on_label_again)7475 def click_on_label_again(event):7677 self.info_label_object.place_configure(relwidth=0.05)7879 self.info_label_object["text"] = "Info"8081 self.info_label_object.bind("<Button-1>",click_on_label)8283 self.info_label_object = tk.Label(84 self,85 bg="white",86 fg="black",87 text="Info",88 cursor="hand2"89 )9091 self.info_label_object.place_configure(relx=0.4,rely=0.2656,relheight=0.032,relwidth=0.05)9293 self.info_label_object.bind("<Motion>",change_color_on_motion)9495 self.info_label_object.bind("<Leave>",move_out_mouse_from_area_of_label)9697 self.info_label_object.bind("<Button-1>",click_on_label)9899 def set_and_place_show_label(self):100101 def change_color_on_motion(event):102103 self.show_label_object["fg"] = "red"104105 def move_out_mouse_from_area_of_label(event):106107 self.show_label_object["fg"] = "black"108109 def click_on_label(event):110111 self.password_entry_object["show"] = ""112113 self.show_label_object["text"] = "Hide"114115 self.show_label_object.bind("<Button-1>",click_on_label_again)116117 def click_on_label_again(event):118119 self.password_entry_object["show"] = "*"120121 self.show_label_object["text"] = "Show"122123 self.show_label_object.bind("<Button-1>",click_on_label)
...
C8261735.py
Source:C8261735.py
1'''2Created on April 1, 20193@author: varun4Testcase Name : Check property default5Testcase ID : http://lnxtestrail.ibi.com/testrail/index.php?/cases/view/82617356'''7import unittest8from common.lib.basetestcase import BaseTestCase9from common.wftools import login10from common.wftools import wf_mainpage11from common.lib import utillity12from common.locators.wf_mainpage_locators import WfMainPageLocators13from common.lib import core_utility14from common.wftools import designer_portal15from common.lib.global_variables import Global_variables16class C8261735_TestClass(BaseTestCase):17 18 def test_C8261735(self):19 """20 Test case objects21 """22 global_obj = Global_variables()23 portal_obj = designer_portal.Portal(self.driver)24 core_util_obj = core_utility.CoreUtillityMethods(self.driver)25 login_obj = login.Login(self.driver)26 main_page_obj = wf_mainpage.Wf_Mainpage(self.driver)27 util_obj = utillity.UtillityMethods(self.driver)28 29 """30 Test case variables31 """32 project_id = core_util_obj.parseinitfile('project_id')33 suite_id = core_util_obj.parseinitfile('suite_id')34 group_id= core_util_obj.parseinitfile('group_id')35 folder_name=project_id+'_'+suite_id36 folder_name_path=folder_name+'->'+group_id37 38 """39 Test case CSS40 """41 domains_css = ".toolbar"42 portal_dialog_css = ".create-pvd-dialog .ibx-title-bar-caption .ibx-label-text"43 workspace = "Workspaces"44 45 """46 Step 1: Login WF as domain advanced user47 """48 login_obj.invoke_home_page('mrid', 'mrpass')49 50 """51 Step 2: Click on Content tree from side bar.52 """53 main_page_obj.select_content_from_sidebar()54 55 """56 Step 3: Expand 'P292_S19901' domain-> Click on 'G671769' folder;57 Select Designer tag and click on Portal tile in action bar.58 Verify the create portal dialog appears with maximum width set to 100% by default and is active as below59 """60 util_obj.synchronize_with_visble_text(domains_css, workspace, main_page_obj.home_page_short_timesleep)61 main_page_obj.expand_repository_folder(folder_name_path)62 util_obj.synchronize_with_number_of_element(WfMainPageLocators.ACTION_BAR_CSS, 1, main_page_obj.home_page_medium_timesleep )63 main_page_obj.select_action_bar_tab('Designer')64 main_page_obj.select_action_bar_tabs_option('Portal')65 util_obj.synchronize_with_visble_text(portal_dialog_css, 'New Portal', main_page_obj.home_page_short_timesleep )66 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(verify_placeholder_value='100%',step_number='3.1')67 68 """69 Step 4: Click inside 'Maximum width' text box70 Verify that in CR it is editable71 Verify that in IE11 the 100% is cleared out72 """73 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(edit_value='')74 if (global_obj.browser_name != 'ie'):75 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(current_mode='enable',step_number='4.1')76 else:77 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(verify_placeholder_value='', step_number='4.1')78 79 """80 Step 5: Click anywhere outside of the text box81 Verify that it reverts back to 100% and nothing has changed in appearance82 """83 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(click_on_label=True)84 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(verify_placeholder_value='100%',step_number='5.1')85 86 """87 Step 6: Choose 'Three level' navigation88 Verify the Maximum width is still 100%89 """90 portal_obj.three_level_navigation_radiobutton_in_new_or_edit_portal_dialog(select_type='check')91 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(verify_placeholder_value='100%',step_number='6.1')92 93 """94 Step 7: Click inside 'Maximum width' text box95 Verify that in CR it is editable96 Verify that in IE11 the 100% is cleared out97 """98 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(edit_value='')99 if (global_obj.browser_name != 'ie'):100 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(current_mode='enable',step_number='7.1')101 else:102 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(verify_placeholder_value='', step_number='7.1')103 104 """105 Step 8: Click anywhere outside of the text box106 Verify that it reverts back to 100% and nothing has changed in appearance107 """108 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(click_on_label=True)109 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(verify_placeholder_value='100%',step_number='8.1')110 111 """112 Step 9: Choose 'Two level Top 'navigation113 Verify the Maximum width is still 100%114 """115 portal_obj.two_level_top_navigation_radiobutton_in_new_or_edit_portal_dialog(select_type='check')116 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(verify_placeholder_value='100%',step_number='9.1')117 118 """119 Step 10: Click inside 'Maximum width' text box120 Verify that in CR it is editable121 Verify that in IE11 the 100% is cleared out122 """123 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(edit_value='')124 if (global_obj.browser_name != 'ie'):125 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(current_mode='enable',step_number='10.1')126 else:127 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(verify_placeholder_value='', step_number='10.1')128 129 """130 Step 11: Click anywhere outside of the box131 Verify that it reverts back to 100% and nothing has changed in appearance132 """133 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(click_on_label=True)134 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(verify_placeholder_value='100%',step_number='11.1')135 136 """137 Step 12: Click inside 'Maximum width' text box138 """139 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(edit_value='')140 141 """142 Step 13: Enter 75 then click anywhere outside the box143 Verify the maximum width value automatically picks up px (75px) and the % disappeared.144 """145 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(edit_value='75')146 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(click_on_label=True)147 portal_obj.maximum_width_textbox_in_new_or_edit_portal_dialog(verify_value='75px', step_number='13.1')148 149 """150 Step 14: Click Cancel151 """152 portal_obj.cancel_button_inside_new_or_edit_portal_dialog(select_button=True)153 154 """155 Step 15: Signout WF156 """157 main_page_obj.signout_from_username_dropdown_menu()158 159if __name__ == '__main__':160 unittest.main()161 ...
main.py
Source:main.py
...110 self.frame2.scrollable_frame, text=items[i+1].split(";")[j], relief="groove", font=("Arial", 9, "bold"),111 height=4112 )113 label.grid(column=j, row=i+1, sticky="we", padx=2)114 label.bind("<Button-1>", lambda e, url=label['text']: self.click_on_label(url))115 def select_mode(self):116 with open("config/mode.txt", "r") as f:117 mode = f.readline()118 if mode == "add":119 with open("config/mode.txt", "w") as f:120 f.write("delete")121 self.select_mod_btn['image'] = self.photo_2122 else:123 with open("config/mode.txt", "w") as f:124 f.write("add")125 self.select_mod_btn['image'] = self.photo126 def click_on_label(self, item):127 print(item)128 def csv_writer(self):129 get_id = len(csv_options.csv_task("database/items.csv", "r"))130 csv_options.csv_task("database/items.csv", "a", f"\n{str(get_id-1)};1234567890;test item 1;124;1")131 self.show_items()132 self.root.update()133 self.frame2.update()134 def start_settings(self):135 root = tk.Tk()136 run = start_settings.ChildRoot(root)137 root.mainloop()138# Make one method to decode the barcode139def barcode_reader(image):140 # read the image in numpy array using cv2...
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!!