How to use query_selector method in Playwright Python

Best Python code snippet using playwright-python

Getir.py

Source:Getir.py Github

copy

Full Screen

...54 self.get_sub_category_from_web(category)55 def get_category_from_web(self):56 category_name = []57 self.page.goto(gv.GETIR_HOME)58 section_class_category = self.page.query_selector(59 'section[class^=style__CategoriesWrapper]')60 if section_class_category != None:61 html = section_class_category.inner_html()62 soup = BeautifulSoup(html, "html.parser")63 all_categories = soup.find_all("span")64 for category in all_categories:65 if (category.text != "") and (category.text not in category_name):66 category_name.append(category.text)67 for category in category_name:68 if self.database.get_category_with_name(category) == None:69 category_obj = Category(name=category)70 self.database.add_category(category_obj)71 logging.info(f"Category {category} added to database")72 self.load_category_from_db()73 def get_sub_category_from_web(self, category: Category):74 if (self.page.url == gv.GETIR_HOME):75 self.page.click(f'img[alt="{category.name}"]')76 dongu = True77 while dongu:78 all_query = self.page.query_selector_all(79 "div[data-testid='breadcrumb-item']")80 for query in all_query:81 if (query.inner_text() == category.name):82 dongu = False83 panel_body = self.page.query_selector(84 'div[data-testid="panel-body"]')85 if panel_body != None:86 html = panel_body.inner_html()87 soup = BeautifulSoup(html, "html.parser")88 all_sub_categories = soup.find_all("a")89 for sub_category in all_sub_categories:90 sub_category_span = sub_category.select(91 'span[data-testid="text"]')[0].text92 if self.database.get_sub_category_with_id_name(category.id, sub_category_span) == None:93 sub_category_obj = SubCategory(name=sub_category_span)94 self.database.add_sub_category(95 sub_category_obj, category)96 logging.info(97 f"Sub Category {sub_category_span} added to database")98 elif ("https://getir.com/kategori/" in self.page.url):99 collapse_div = self.page.query_selector(100 'div[data-testid="collapse"]')101 panel_divs = collapse_div.query_selector_all(102 'div[data-testid="panel"]')103 for panel_div in panel_divs:104 span_text = panel_div.query_selector(105 'span[data-testid="text"]').inner_text()106 if span_text == category.name:107 panel_div.click()108 panel_body = panel_div.query_selector(109 'div[data-testid="panel-body"]')110 if panel_body != None:111 html = panel_body.inner_html()112 soup = BeautifulSoup(html, "html.parser")113 all_sub_categories = soup.find_all("a")114 for sub_category in all_sub_categories:115 sub_category_span = sub_category.select(116 'span[data-testid="text"]')[0].text117 if self.database.get_sub_category_with_id_name(category.id, sub_category_span) == None:118 sub_category_obj = SubCategory(119 name=sub_category_span)120 self.database.add_sub_category(121 sub_category_obj, category)122 logging.info(123 f"Sub Category {sub_category_span} added to database")124 break125 else:126 self.page.goto(gv.GETIR_HOME)127 self.get_sub_category_from_web(category)128 def get_sub_categories_with_category(self, category: Category) -> List[SubCategory]:129 return self.database.get_sub_categories(category)130 def get_getir_all_sub_category(self):131 for category in self.category_list:132 self.get_sub_category_from_web(category)133 def go_category(self, category: Category):134 if (self.page.url == gv.GETIR_HOME):135 # home screen136 self.page.click(f'img[alt="{category.name}"]')137 sleep(2) # WAİT FOR PAGE LOAD WİTH PLAYWRIGHT NOT TIME.SLEEP138 self.page.query_selector(139 "div[name='category-products']").wait_for_element_state("visible")140 all_query = self.page.query_selector_all(141 "div[data-testid='breadcrumb-item']")142 for query in all_query:143 if (query.inner_text() == category.name):144 break145 # dongu = True146 # while dongu:147 # all_query = self.page.query_selector_all("div[data-testid='breadcrumb-item']")148 # for query in all_query:149 # if (query.inner_text() == category.name):150 # dongu = False151 elif ("https://getir.com/kategori/" in self.page.url):152 # category page153 collapse_div = self.page.query_selector(154 'div[data-testid="collapse"]')155 panel_divs = collapse_div.query_selector_all(156 'div[data-testid="panel"]')157 for panel_div in panel_divs:158 span_text = panel_div.query_selector(159 'span[data-testid="text"]').inner_text()160 if span_text == category.name:161 panel_div.click()162 else:163 # not in category page164 self.page.goto(gv.GETIR_HOME)165 self.go_category(category)166 def go_sub_category(self, sub_category: SubCategory):167 category = self.database.get_category_with_sub_category(sub_category)168 if category != None:169 self.go_category(category)170 collapse_div = self.page.query_selector(171 'div[data-testid="collapse"]')172 panel_divs = collapse_div.query_selector_all(173 'div[data-testid="panel"]')174 for panel_div in panel_divs:175 span_text = panel_div.query_selector(176 'span[data-testid="text"]').inner_text()177 if span_text == category.name:178 panel_body = panel_div.query_selector(179 'div[data-testid="panel-body"]')180 if panel_body != None:181 a_list = panel_body.query_selector_all('a')182 for a in a_list:183 span_text = a.query_selector(184 'span[data-testid="text"]').inner_text()185 if span_text == sub_category.name:186 a.click()187 break188 def clear_text_for_sql_injection(self, text: str) -> str:189 return text.replace("'", "").replace('"', "").replace("\\", "").replace("'", "").replace("é", "")190 def clear_price(self, price: str) -> float:191 return float(price.replace("₺", "").replace(",", "."))192 def get_all_getir_products(self, pass_yeni_urunler : bool = True, pass_indirimler : bool = True, pass_ilginizi_cekebilecekler : bool = True ):193 for category in self.category_list:194 self.page.goto(gv.GOOGLE)195 if pass_yeni_urunler and category.name == "Yeni Ürünler":196 print("Pass Yeni Ürünler")197 pass198 elif pass_indirimler and category.name == "İndirimler":199 print("Pass İndirimler")200 pass201 else:202 for sub_category in self.get_sub_categories_with_category(category):203 if pass_ilginizi_cekebilecekler and sub_category.name == "İlginizi Çekebilecekler":204 print("Pass İlginizi Çekebilecekler")205 pass206 else:207 self.go_sub_category(sub_category)208 self.get_product_list_web(sub_category)209 def get_card_wrapper(self, sub_category: SubCategory):210 self.page.query_selector(211 "div[name='category-products']").wait_for_element_state("visible")212 213 div_category_products = self.page.query_selector(214 "div[name='category-products']")215 216 div_list = div_category_products.query_selector_all("div")217 for div in div_list:218 header_div = div.query_selector(219 "div[class^='style__HeaderWrapper']")220 if header_div != None:221 h5_text = header_div.query_selector("h5").inner_text()222 if h5_text == sub_category.name:223 card_wrapper = div.query_selector(224 "div[class^='style__CardWrapper']")225 html = card_wrapper.inner_html()226 return html227 elif header_div == None:228 # header_div bulamıyorsan229 breadcrumb_item = self.page.query_selector_all(230 "div[data-testid='breadcrumb-item']")[1].inner_text()231 if breadcrumb_item == sub_category.name:232 print("BULDUM ONU")233 selected_div = div_list[0]234 card_wrapper = selected_div.query_selector(235 "div[class^='style__CardWrapper']")236 html = card_wrapper.inner_html()237 return html238 239 def get_product_list_db(self, sub_category: SubCategory) -> List[Product]:240 return self.database.get_product_w_sub_category(sub_category)241 def get_product_list_web(self, sub_category: SubCategory):242 """Get product list from web page with sub_category"""243 print(f"Getting product list with sub category {sub_category.name}")244 new_product_count = 0245 old_product_count = 0246 247 change_price_count = 0248 249 html = None250 category = self.database.get_category_with_sub_category(sub_category)251 252 if category != None:253 html = self.get_card_wrapper(sub_category)254 #TODO START255 # sub_category_list = category.get_sub_categories()256 257 # selected_index = 0258 # for index, sub_category_f in enumerate(sub_category_list):259 # if (sub_category_f.name == sub_category.name):260 # selected_index = index261 # break262 263 # div_category_products = self.page.query_selector(264 # "div[name='category-products']")265 # div_list = div_category_products.query_selector_all("div")266 # selected_div = div_list[selected_index]267 # card_wrapper = selected_div.query_selector(268 # "div[class^='style__CardWrapper']")269 # if card_wrapper == None:270 # print("wtf")271 # else:272 # html = card_wrapper.inner_html()273 #BU ŞEKİLDE İLK 2 DIVDE ÇALIŞIYOR SONRA ÇALIŞMIYOR FAKAT DAHA HIZLI ÇALIŞIYOR. 274 #TODO STOP275 if html != None:276 soup = BeautifulSoup(html, "html.parser")277 all_product_article = soup.find_all("article")278 for product_article in all_product_article:279 has_discount = False280 discount_price = "0"281 src = product_article.select("img")...

Full Screen

Full Screen

test_grandpy_frontend.py

Source:test_grandpy_frontend.py Github

copy

Full Screen

...64 self.visit_url()65 assert self.driver.current_url == "http://127.0.0.1:8943/" or self.driver.current_url == "http://localhost:8943/"6667 def send_message(self, message, send=True): 68 self.chat_input = self.query_selector('#input_area')69 self.chat_input.send_keys(message)70 if send: self.query_selector("#submit_button").click()7172@pytest.mark.gpansfe73class TestGrandPyAnswersFrontEndSide(TestMasterClass):7475 @pytest.mark.gpansfe076 def test_if_grandpys_welcome_message_is_correctly_displayed(self):7778 time.sleep(2)79 80 self.message = self.query_selector("#message1")81 self.part_of_expected_answer = "Salut 👋, qu'est-ce que je peux faire pour toi ?\n\nTu peux me demander, dans le formulaire juste en bas avec 'Nouveau message' écrit dedans :"8283 assert self.part_of_expected_answer in self.message.text8485 @pytest.mark.gpansfe186 def test_if_grandpy_gives_the_adress_and_the_info_related_to_the_adress_and_if_the_map_is_displayed(self):8788 self.send_message("Connais-tu l'adresse d'OpenClassrooms") 8990 time.sleep(6)9192 self.answer = self.query_selector("#message3")93 self.maps = self.query_selector(".map div.gm-style")94 self.anecdocte = self.query_selector("#message5")9596 assert self.answer.text == "Bien sûr mon poussin ! La voici : \"7 Cité Paradis, 75010 Paris\".\nEt voilà une carte pour t'aider en plus !!"97 assert self.maps.is_displayed98 assert "Mais t'ai-je déjà raconté l'histoire de ce quartier qui m'a vu en culottes courtes ?" in self.anecdocte.text99100 @pytest.mark.gpansfe2101 def test_if_grandpy_greets_back(self):102103 self.chat_input = self.query_selector('#input_area')104 self.chat_input.send_keys('bonjour', Keys.ENTER)105106 time.sleep(2)107108 self.answer = self.query_selector("#message3")109110 assert self.answer.text in ["Bonjour!", "Salut!", "Yo!", "Hi!!", "👋"]111112 @pytest.mark.gpansfe3113 def test_if_grandpy_answers_accordingly_when_asked_for_something_out_of_his_current_scope(self):114115 self.send_message('Garçon !! Je voudrais un verre d\'hydromel, avec 3 glaçons !')116117 time.sleep(2)118119 self.answer = self.query_selector("#message3")120121 assert self.answer.text == "Désolé, je n'ai pas compris ton message... 😕 Dans une prochaine version peut-être ?"122123 @pytest.mark.gpansfe4124 def test_what_grandpy_says_when_the_user_clicks_on_the_GrandPy_logo(self):125126 self.brand = self.query_selector("#brand_logo > a")127128 self.reactions = {129 0 : "Pourquoi tu appuies sur mon logo, t'es fou ou quoi ? Je suis plus très jeune, c'est fragile ici !!",130 1 : "Mais !?",131 2 : "Ça va !?",132 3 : "Tu peux arrêter ??",133 4 : "C'EST FINI OUI ?",134 5 : "FRANCHEMENT ?",135 7 : "Aucune empathie hein :/",136 9 : "10 fois de suite... OK. T'as gagné.",137 10: "..."138 }139140 for i in range(11): 141142 self.brand.click()143 time.sleep(2) 144 self.answer = self.query_selector(".grandpy_type:last-child > div")145 146 if i in range(6) or i in [7,10]:147 assert self.answer.text == self.reactions[i]148149@pytest.mark.gpux150class TestUserExperience(TestMasterClass): 151152 @pytest.mark.gpux1153 def test_if_the_message_is_sent_when_the_user_hits_enter(self):154 self.visit_url()155156 self.text_area = self.query_selector('#input_area')157 self.text_area.send_keys('bonjour', Keys.ENTER)158159 time.sleep(2)160161 self.answer = self.query_selector("#message3")162163 assert self.answer.text in ["Bonjour!", "Salut!", "Yo!", "Hi!!", "👋"]164165 @pytest.mark.gpux2166 def test_if_the_loading_animation_is_displayed(self):167 168 time.sleep(0.5)169 self.loading_animation1 = self.query_selector("#animation1")170 assert self.loading_animation1.is_displayed()171172 time.sleep(2)173174 self.send_message("bonjour")175 176 time.sleep(0.5)177 self.loading_animation2 = self.query_selector("#animation3")178 assert self.loading_animation2.is_displayed()179180 @pytest.mark.gpux3181 def test_if_the_last_message_is_always_displayed_to_the_user(self):182183 self.send_message('Bonjour')184 self.send_message('Au revoir')185 self.send_message('Special Feature')186 self.send_message('Wow')187188 time.sleep(2)189190 self.answer = self.query_selector(".message_container:last-child")191192 assert self.answer.rect['y'] <= 660 #Ex de rect : {'height': 18, 'width': 61, 'x': 306, 'y': 4051}. Le message est directement visible si les coordonnées sont inférieures à (très très très grossièrement) à 611.193194 @pytest.mark.gpux4195 def test_if_the_last_message_is_displayed_when_the_user_type_something_in_the_input(self):196197 self.send_message('Bonjour')198 self.send_message('Au revoir')199 self.send_message('Special Feature')200 self.send_message('Wow')201202 time.sleep(1)203204 self.target = self.query_selector("#dialogue_area")205206 while self.query_selector("#message1").rect["y"] < 0:207 ActionChains(self.driver).send_keys_to_element(self.target, Keys.ARROW_UP).perform()208209 self.chat_input = self.query_selector('#input_area')210 self.chat_input.send_keys("message")211212 self.last_message = self.query_selector(".message_container:last-child")213214 time.sleep(1)215216 assert self.last_message.rect['y'] <= 660217218 @pytest.mark.gpux5219 def test_if_the_inputbox_expands_shrinks_when_the_user_adds_and_removes_content_from_it(self):220221 self.chat_input = self.query_selector('#input_area')222223 assert self.chat_input.rect["height"] in range(55,61)224225 self.chat_input.send_keys("H".join(["A" for _ in range (300)]))226227 assert self.chat_input.rect["height"] in range(200,225)228229 while self.chat_input.get_attribute('value'): 230 self.chat_input.send_keys(Keys.BACKSPACE)231 ...

Full Screen

Full Screen

schedule.py

Source:schedule.py Github

copy

Full Screen

...11 def element_select(self, forName, selectName='.el-select', options='1'):12 # 删除所有可以被选择的下拉框13 self.execute_script('$("body>.el-popper.el-select-dropdown").remove()')14 # 点击 弹出选择框15 self.query_selector('label[for="' + forName + '"]+.el-form-item__content ' + selectName).click()16 # 选择 第一项17 self.query_selector(18 'body>.el-popper.el-select-dropdown .el-select-dropdown__item:nth-child(' + options[0] + ')').click()19 def element_more_select(self, forName, selectName='.el-select', options='1'):20 # 删除所有可以被选择的下拉框21 self.execute_script('$("body>.el-popper.el-select-dropdown").remove()')22 # 点击 弹出选择框23 self.query_selector('label[for="' + forName + '"]+.el-form-item__content ' + selectName).click()24 # 多个选择25 for nthChild in options:26 if nthChild is not ',':27 self.element_click('点击第{}周'.format(nthChild),28 'body>.el-popper.el-select-dropdown .el-select-dropdown__item:nth-child({})'.format(29 nthChild), times=1)30 def element_cascader(self, forName, selectName='.el-cascader', options='1,1'):31 # 删除所有可以被选择的下拉框32 self.execute_script('$("body>.el-popper.el-cascader__dropdown").remove()')33 # 点击 弹出选择框34 self.query_selector('label[for="' + forName + '"]+.el-form-item__content ' + selectName).click()35 # 选择 第一项36 self.query_selector(37 'body>.el-popper.el-cascader__dropdown .el-cascader-menu:nth-child(1) .el-cascader-node__label:nth-child(' +38 options[0] + ')').click()39 self.element_click('点击_' + forName + '_按钮',40 'body>.el-popper.el-cascader__dropdown .el-cascader-menu:nth-child(2) .el-cascader-node__label:nth-child(' +41 options[2] + ')', times=1)42 def element_picker_panel(self, forName, selectName='.el-date-editor'):43 # 删除所有可以被选择的下拉框44 self.execute_script('$("body>.el-popper.el-picker-panel").remove()')45 # 点击 弹出选择框46 self.query_selector('label[for="' + forName + '"]+.el-form-item__content ' + selectName).click()47 # 选择 今天的后一天48 self.query_selector('body>.el-popper.el-picker-panel .today+.available').click()49 def schedule(self, clName):50 self.wait_time(1)51 # 点击进入 校务菜单52 self.element_click('点击顶部_校务_按钮', '#tab-0', times=1)53 # 传递需要名字54 self.button_show_click(["校务管理", "课程管理", "班级管理"])55 # loading 加载状态56 self.check_not_display('班级 loading 加载', '.view .el-loading-mask', times=2)57 if clName is not None:58 # 搜索 班级 className59 self.query_selector('.view input[placeholder="请输入班级名称"]').send_keys(clName)60 # 等待元素出现61 self.check_displayed('等待排课按钮出现', '.view .el-table__fixed-right tr:nth-child(1) td .operation-part .el-button',62 times=2)63 # 选择排课64 allButton = self.query_selector_all('.view .el-table__fixed-right tr:nth-child(1) td .operation-part .el-button')65 # 确定基础操作按钮 为 4 个66 if len(allButton) is not 4:67 print('{}-班级,已经排过课'.format(clName))68 return clName69 print(allButton[2].get_attribute('textContent'), '=========textContent')70 # 点击排课按钮71 allButton[2].click()72 # 选择 上课周期 默认选择四个73 self.element_more_select(forName='attendClassWeeks', options='1,2,3,4')74 # 选择 选择上课时间段75 # self.query_selector('label[for="classHours"]+.el-form-item__content .el-select ').click()76 # 选择 定制时间77 self.query_selector('.customizingtime').click()78 # 删除 无法选中的内容79 self.execute_script('$("body>.el-time-range-picker.el-popper").remove()')80 # 打开 定制时间 弹窗81 self.query_selector('.el-dialog[aria-label="定制时间"] .el-date-editor').click()82 # 开始时间 17 点83 self.query_selector('body>.el-time-range-picker.el-popper .el-time-spinner__list .el-time-spinner__item:nth-child(18)').click()84 # 点击确认85 self.query_selector('body>.el-time-range-picker.el-popper .el-time-panel__footer .confirm').click()86 # 关闭 定制时间 弹窗87 self.query_selector('.el-dialog[aria-label="定制时间"] .dialog-footer .el-button:nth-child(2)').click()88 # 生成排课89 self.query_selector('.view .add-top .el-row:nth-child(4) .el-button').click()90 # 等待 生成排课91 self.check_displayed('是否生成排课', '.view .mind_list .table .tab_li:nth-child(2)', times=2)92 # 保存排课93 self.query_selector('.view .create_btn .el-button:nth-child(2)').click()94 # 是否存在 aria-label="老师被其他排课占用"95 self.element_click('老师被其他排课占用', '.el-message-box__wrapper[aria-label="老师被其他排课占用"] .el-button--primary', times=3)96# 单独测试时 使用97if __name__ == '__main__':98 # print(os.path.abspath('../ice.png'))99 #100 driverAddStudent = init_drives('https://uat-edurp.ambow.com/',101 "../../../myproject/testSeleuim/chromedriver_win32/chromedriver.exe")102 Login(driverAddStudent).xiao_wu_login('wei.xia@ambow.com', 'Ambow88888888')103 # 全屏幕104 driverAddStudent.maximize_window()105 # 新增学生106 studentName = AddStudent(driverAddStudent).add_student()107 # 新增班级...

Full Screen

Full Screen

addClass.py

Source:addClass.py Github

copy

Full Screen

...10 def element_select(self, forName, selectName='.el-select', options='1', otherSelect=None):11 # 删除所有可以被选择的下拉框12 self.execute_script('$("body>.el-popper.el-select-dropdown").remove()')13 # 点击 弹出选择框14 self.query_selector('label[for="' + forName + '"]+.el-form-item__content ' + selectName).click()15 # 填入老师16 if otherSelect is not None:17 self.check_displayed('选择老师',18 'body>.el-popper.el-select-dropdown .el-select-dropdown__item:nth-child(' + options[19 0] + ')', times=2)20 # 选择指定选项21 self.query_selector(22 'label[for="' + forName + '"]+.el-form-item__content ' + selectName + ' .el-input__inner').send_keys(23 otherSelect)24 self.query_selector(25 'body>.el-select-dropdown.el-popper .el-select-dropdown__item:not([style="display: none;"])').click()26 else:27 # 选择 第一项28 self.element_click(29 'body>.el-popper.el-select-dropdown .el-select-dropdown__item:nth-child(' + options[0] + ')').click()30 def element_cascader(self, forName, selectName='.el-cascader', options='1,1'):31 # 删除所有可以被选择的下拉框32 self.execute_script('$("body>.el-popper.el-cascader__dropdown").remove()')33 # 点击 弹出选择框34 self.query_selector('label[for="' + forName + '"]+.el-form-item__content ' + selectName).click()35 # 选择 第一项36 self.query_selector(37 'body>.el-popper.el-cascader__dropdown .el-cascader-menu:nth-child(1) .el-cascader-node__label:nth-child(' +38 options[0] + ')').click()39 self.element_click('点击_' + forName + '_按钮',40 'body>.el-popper.el-cascader__dropdown .el-cascader-menu:nth-child(2) .el-cascader-node__label:nth-child(' +41 options[2] + ')', times=1)42 def element_picker_panel(self, forName, selectName='.el-date-editor'):43 # 删除所有可以被选择的下拉框44 self.execute_script('$("body>.el-popper.el-picker-panel").remove()')45 # 点击 弹出选择框46 self.query_selector('label[for="' + forName + '"]+.el-form-item__content ' + selectName).click()47 # 选择 今天的后一天48 # self.query_selector('body>.el-popper.el-picker-panel .today+.available').click()49 # 按下前一年50 self.query_selector('body>.el-popper.el-picker-panel .el-date-picker__header button[aria-label="前一年"]').click()51 # 选择去年的当月的第一天52 self.query_selector('body>.el-popper.el-picker-panel .el-picker-panel__content .available').click()53 def add_class(self, teacherName='李舟'):54 self.wait_time(1)55 # 点击进入 校务菜单56 self.element_click('点击顶部_校务_按钮', '#tab-0', times=3)57 # 传递需要名字58 self.button_show_click(["校务管理", "课程管理", "班级管理"])59 # 新增班级 按钮60 if self.element_click('新增班级_按钮', '.view .el-button', times=3) is None:61 # 新增班级点击 错误情况下62 self.element_click('新增班级_按钮', '.view .el-button', times=3)63 # 选择 校区64 self.element_cascader(forName='orgId', options='1,1')65 # 选择 立项编号66 self.element_select(forName='subjectCode', options='1')67 # 选择 课程名称68 self.element_select(forName='edaCourseCode', options='4')69 # 选择 任课老师70 self.element_select(forName='teacherId', options='4', otherSelect=teacherName)71 # 选择 开课时间72 self.element_picker_panel(forName='openingTime')73 # 添加班级名称后缀74 classNameSuffix = self.fake.name()75 self.query_selector('label[for="classCourseNameAfter"]+.el-form-item__content .el-input__inner').send_keys(76 classNameSuffix)77 self.query_selector('body').click()78 # 保存班级名字79 classCourseName = self.query_selector(80 'label[for="classCourseName"]+.el-form-item__content .el-input__inner').get_attribute('value')81 # 点击保存按钮82 self.query_selector('.view .el-button:last-child').click()83 # 关闭当前标签84 # self.close_tag()85 # 返回班级名字86 print('新建班级名字为:{}.'.format(classCourseName))87 return classCourseName88# 单独测试时 使用89if __name__ == '__main__':90 # print(os.path.abspath('../ice.png'))91 #92 driverAddStudent = init_drives('https://uat-edurp.ambow.com/',93 "../../../myproject/testSeleuim/chromedriver_win32/chromedriver.exe")94 Login(driverAddStudent).xiao_wu_login('wei.xia@ambow.com', 'Ambow88888888')95 # 全屏幕96 driverAddStudent.maximize_window()...

Full Screen

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Python 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