How to use scroll_to_bottom method in SeleniumBase

Best Python code snippet using SeleniumBase

test_no_cookies.py

Source:test_no_cookies.py Github

copy

Full Screen

...51 '//span[@class="b-header-b-personal-e-icon-count-m-cart basket-in-cart-a"]')52 assert basket_items.text == '0'5354 def test_page_bottom_menu_link_covid(self):55 scroll_to_bottom(pytest.web_driver)56 link_covid = pytest.web_driver.find_element_by_xpath('//a[@class="sprite_kovid kov_desc"]')57 link_covid.click()58 time.sleep(2)59 parent = pytest.web_driver.window_handles[0]60 chld = pytest.web_driver.window_handles[1]61 pytest.web_driver.switch_to.window(chld)62 title = pytest.web_driver.title63 assert title == 'E-commerce против COVID'64 pytest.web_driver.close()65 pytest.web_driver.switch_to.window(parent)6667 # def test_page_bottom_menu_link_akit(self):68 # scroll_to_bottom(pytest.web_driver)69 # link_akit = '//li[@class="b-rfooter-e-item"]/a[@href="//www.labirint.org/vakansii?tab=5"]'70 # hover_move_click(pytest.web_driver, link_akit)71 # # pytest.web_driver.find_element_by_xpath('//li/a[@href="//www.labirint.org/vakansii?tab=5"]').click()72 # # link_akit.click()73 # time.sleep(5)74 # title = pytest.web_driver.title75 # assert title == 'Пользовательское Соглашение об условиях предоставления Услуг в интернет-магазине ' \76 # 'Лабиринт | Лабиринт'777879class TestHeaderItems:80 def test_page_messages(self):81 messages = pytest.web_driver.find_element_by_xpath(82 '//li[@class="b-header-b-personal-e-list-item b-header-b-personal-e-list-item-m-md have-dropdown"]')83 messages.click()84 check_form = pytest.web_driver.find_element_by_xpath(85 '//div[@class="js-auth__title new-auth__title"]')86 assert check_form.text == 'Полный доступ к Лабиринту'8788 def test_page_my_lab(self):89 my_lab = pytest.web_driver.find_element_by_xpath(90 '//span[@class="b-header-b-personal-e-icon b-header-b-personal-e-icon-m-profile '91 'b-header-e-sprite-background"]')92 my_lab.click()93 check_form = pytest.web_driver.find_element_by_xpath(94 '//div[@class="js-auth__title new-auth__title"]')95 assert check_form.text == 'Полный доступ к Лабиринту'9697 def test_page_put_aside(self):98 put_aside = pytest.web_driver.find_element_by_xpath(99 '//span[@class="b-header-b-personal-e-icon-wrapper <!--b-header-b-personal-e-icon-wrapper-m-putorder-->"]')100 put_aside.click()101 active_header = pytest.web_driver.find_element_by_xpath(102 '//li[@class="cabinet-menu__tab cabinet-menu__tab_active"]/a')103 active_link = active_header.get_attribute('href')104 # print('\n', active_link)105 assert active_link == 'https://www.labirint.ru/cabinet/putorder/'106107 def test_page_basket(self):108 basket_link = pytest.web_driver.find_element_by_xpath(109 '//li[@class="b-header-b-personal-e-list-item have-dropdown last-child"]/a').get_attribute('href')110 # print(basket_link)111 open_page(pytest.web_driver, basket_link)112 title = pytest.web_driver.title113 assert title == 'Корзина. Проверьте заказ. Интернет-магазин Лабиринт.'114115 def test_page_discount_commertial(self):116 discount = pytest.web_driver.find_element_by_xpath(117 '//span[@class="b-header-labelaction-text b-header-b-logo-e-discount-e-text-m-long"]')118 discount.click()119 pytest.web_driver.implicitly_wait(2)120 assert pytest.web_driver.find_element_by_xpath(121 '//div[@class="h2 relative main-block-carousel-title-outer"]').is_displayed()122123124class TestHeaderFirstMenu:125 def test_page_b_menu_books(self):126 books = pytest.web_driver.find_element_by_xpath(127 '//a[@href="/books/"]')128 books.click()129 pytest.web_driver.implicitly_wait(2)130 assert pytest.web_driver.find_element_by_xpath(131 '//h1[@class="genre-name"]').text == "Книги"132133 def test_page_b_menu_best(self):134 best = pytest.web_driver.find_element_by_xpath(135 '//a[@href="/best/"]')136 best.click()137 pytest.web_driver.implicitly_wait(2)138 assert pytest.web_driver.find_element_by_xpath(139 '//div[@class="content-block"]/h1').text == "Главные книги 2022"140141 def test_page_b_menu_school(self):142 school = pytest.web_driver.find_element_by_xpath(143 '//a[@href="/school/"]')144 school.click()145 pytest.web_driver.implicitly_wait(2)146 assert pytest.web_driver.find_element_by_xpath(147 '//h1[@class="school-cap__header"]').text == "Все учебники в Лабиринте"148149 def test_page_b_menu_games(self):150 games = pytest.web_driver.find_element_by_xpath(151 '//a[@href="/games/"]')152 games.click()153 pytest.web_driver.implicitly_wait(2)154 assert pytest.web_driver.find_element_by_xpath(155 '//h1[@class="genre-name"]').text == "Игры и игрушки"156157 def test_page_b_menu_office(self):158 office = pytest.web_driver.find_element_by_xpath(159 '//a[@href="/office/"]')160 office.click()161 pytest.web_driver.implicitly_wait(2)162 assert pytest.web_driver.find_element_by_xpath(163 '//h1[@class="genre-name"]').text == "Канцелярские товары"164165 def test_page_b_menu_multimedia(self):166 more_locator = '//span[@class="b-header-b-menu-e-text"]'167 active = '//li[@class="b-menu-second-item active"]'168 hover(pytest.web_driver, more_locator, 0, 25, active)169 assert pytest.web_driver.title == "Полная линейка продуктов мультимедиа | Интернет-магазин Лабиринт"170171 # def test_page_b_menu_multimedia_location():172 # more_locator = '//li[@data-event-content="Еще"]'173 # hidden_link = '//a[@class="b-menu-list-title b-menu-list-title-first" and @href="/multimedia/"]'174 # active = '//li[@class="b-menu-second-item active"]'175 # hover_location(pytest.web_driver, more_locator, hidden_link, active)176 # assert pytest.web_driver.title == "Полная линейка продуктов мультимедиа | Интернет-магазин Лабиринт"177178 def test_page_b_menu_souvenir(self):179 more_locator = '//span[@class="b-header-b-menu-e-text"]'180 active = '//li[@class="b-menu-second-item active"]'181 hover(pytest.web_driver, more_locator, 0, 70, active)182 assert pytest.web_driver.title == "Сувениры, рамки и альбомы для фотографий, календари и открытки | купить и " \183 "подарить с доставкой | Лабиринт"184185 def test_page_b_menu_journals(self):186 more_locator = '//span[@class="b-header-b-menu-e-text"]'187 active = '//li[@class="b-menu-second-item active"]'188 hover(pytest.web_driver, more_locator, 0, 105, active)189 assert pytest.web_driver.find_element_by_xpath(190 '//h1[@class="mag-h1"]').text == "Журнальный лабиринт"191192 def test_page_b_menu_household(self):193 more_locator = '//span[@class="b-header-b-menu-e-text"]'194 active = '//li[@class="b-menu-second-item active"]'195 hover(pytest.web_driver, more_locator, 0, 145, active)196 assert pytest.web_driver.find_element_by_xpath(197 '//h1[@class="genre-name"]').text == "Товары для дома"198199 def test_page_b_menu_club(self):200 club = pytest.web_driver.find_element_by_xpath(201 '//a[@href="/club/"]')202 club.click()203 title = pytest.web_driver.title204 assert title == 'Книжный клуб интернет-магазина Лабиринт'205206 def test_page_b_menu_region_location(self):207 region_location = pytest.web_driver.find_element_by_xpath(208 '//span[@class="region-location-icon-txt "]')209 region_location.click()210 city = pytest.web_driver.find_elements_by_xpath('//span[@class="g-alttext-deepblue pointer"]')[8]211 city.click()212 pytest.web_driver.implicitly_wait(2)213 region_location = pytest.web_driver.find_element_by_xpath(214 '//span[@class="region-location-icon-txt "]')215 title = region_location.get_attribute('title')216 assert title == 'Тюмень'217 delivery = pytest.web_driver.find_element_by_xpath(218 '//span[@class="b-header-b-menu-e-text"]/a[@href="/maps/"]')219 delivery.click()220 assert pytest.web_driver.find_element_by_id('js-tab-2').is_displayed()221 pytest.web_driver.back()222 points = pytest.web_driver.find_element_by_xpath(223 '//a[@href="/maps/" and @class="b-header-b-sec-menu-e-link"]')224 points.click()225 assert pytest.web_driver.find_element_by_id('js-tab-2').is_displayed()226227228class TestHeaderSecondMenu:229 def test_page_b_sec_menu_delivery_payment(self):230 delivery_payment = pytest.web_driver.find_element_by_xpath(231 '//a[@href="/help/" and @class="b-header-b-sec-menu-e-link"]')232 delivery_payment.click()233 title = pytest.web_driver.title234 assert title == 'Помощь | Лабиринт'235236 def test_page_b_sec_menu_certificates(self):237 certificates = pytest.web_driver.find_element_by_xpath(238 '//a[@href="/top/certificates/" and @class="b-header-b-sec-menu-e-link"]')239 certificates.click()240 title = pytest.web_driver.title241 assert title == 'Сертификаты'242243 def test_page_b_sec_menu_rating(self):244 rating = pytest.web_driver.find_element_by_xpath(245 '//a[@href="/rating/?id_genre=-1&nrd=1" and @class="b-header-b-sec-menu-e-link"]')246 rating.click()247 title = pytest.web_driver.title248 assert title == 'Рейтинг: лучшие книги 2022 | Лабиринт - Рейтинг'249250 def test_page_b_sec_menu_novelty(self):251 novelty = pytest.web_driver.find_element_by_xpath(252 '//a[@href="/novelty/" and @class="b-header-b-sec-menu-e-link"]')253 novelty.click()254 title = pytest.web_driver.title255 assert title == 'Новые книги 2022 года | Лабиринт - Новинки'256257 def test_page_b_sec_menu_discount(self):258 discount = pytest.web_driver.find_element_by_xpath(259 '//a[@href="/sale/" and @class="b-header-b-sec-menu-e-link"]')260 discount.click()261 pytest.web_driver.implicitly_wait(2)262 assert pytest.web_driver.find_element_by_xpath(263 '//div[@class="h2 relative main-block-carousel-title-outer"]').is_displayed()264265 def test_page_b_sec_menu_phone(self):266 phone = pytest.web_driver.find_element_by_xpath(267 '//li[@class="b-header-b-sec-menu-e-list-item have-dropdown have-dropdown-clickable analytics-click-js"]')268 phone.click()269 pytest.web_driver.implicitly_wait(1)270 assert pytest.web_driver.find_elements_by_xpath('//a[@href="#" and @class="btn btn-small btn-clear '271 'font_regular-btn"]')[0].is_displayed()272273 def test_page_b_sec_menu_contact(self):274 contact = pytest.web_driver.find_element_by_xpath(275 '//a[@href="/contact/" and @class="b-header-b-sec-menu-e-link"]')276 contact.click()277 title = pytest.web_driver.title278 assert title == 'Контакты книжного интернет-магазина | Лабиринт'279280 def test_page_b_sec_menu_support(self):281 support = pytest.web_driver.find_element_by_xpath(282 '//a[@href="/support/" and @class="b-header-b-sec-menu-e-link"]')283 support.click()284 title = pytest.web_driver.title285 assert title == 'Служба поддержки | Поддержка лабиринта'286287 def test_page_b_sec_menu_socials(self):288 socials = '//div[@class="b-header-b-social"]'289 hover_simple(pytest.web_driver, socials)290 assert pytest.web_driver.find_element_by_xpath('//div[@class="popup-window top-block-popup dropdown-block '291 'b-header-b-sec-menu-e-social-popup '292 'dropdown-block-opened"]').is_displayed()293294295class TestPageBottomMenuInPocket: # check bottom links in menu "Лабиринт в кармане"296 def test_page_bottom_menu_app_store(self):297 scroll_to_bottom(pytest.web_driver)298 app_store = pytest.web_driver.find_element_by_xpath('//a[@data-event-content="App Store"]')299 app_store.click()300 time.sleep(2)301 parent = pytest.web_driver.window_handles[0]302 chld = pytest.web_driver.window_handles[1]303 pytest.web_driver.switch_to.window(chld)304 title = pytest.web_driver.title305 assert title == 'App\xa0Store: Лабиринт.ру — книжный магазин'306 pytest.web_driver.close()307 pytest.web_driver.switch_to.window(parent)308309 def test_page_bottom_menu_goggle_play(self):310 scroll_to_bottom(pytest.web_driver)311 goggle_play = pytest.web_driver.find_element_by_xpath('//a[@data-event-content="Google Play"]')312 goggle_play.click()313 time.sleep(1)314 parent = pytest.web_driver.window_handles[0]315 chld = pytest.web_driver.window_handles[1]316 pytest.web_driver.switch_to.window(chld)317 title = pytest.web_driver.title318 assert title == 'Лабиринт.ру — книжный магазин - Apps on Google Play'319 pytest.web_driver.close()320 pytest.web_driver.switch_to.window(parent)321322 def test_page_bottom_menu_app_gallery(self):323 scroll_to_bottom(pytest.web_driver)324 app_gallery = pytest.web_driver.find_element_by_xpath('//a[@data-event-content="App Gallery"]')325 app_gallery.click()326 time.sleep(10)327 parent = pytest.web_driver.window_handles[0]328 chld = pytest.web_driver.window_handles[1]329 pytest.web_driver.switch_to.window(chld)330 title = pytest.web_driver.title331 assert title == 'AppGallery'332 pytest.web_driver.close()333 pytest.web_driver.switch_to.window(parent)334335336class TestPageBottomMenuSociety: # check bottom links in menu "Мы в соцсетях"337 def test_page_bottom_menu_v_contact(self):338 scroll_to_bottom(pytest.web_driver)339 v_contact = pytest.web_driver.find_element_by_xpath('//a[@data-event-content="ВКонтакте"]')340 v_contact.click()341 time.sleep(5)342 parent = pytest.web_driver.window_handles[0]343 chld = pytest.web_driver.window_handles[1]344 pytest.web_driver.switch_to.window(chld)345 title = pytest.web_driver.title346 assert title == 'Лабиринт | VK'347 pytest.web_driver.close()348 pytest.web_driver.switch_to.window(parent)349350 def test_page_bottom_menu_v_contact_children(self):351 scroll_to_bottom(pytest.web_driver)352 v_contact_children = pytest.web_driver.find_element_by_xpath('//a[@data-event-content="ВКонтакте. Дети"]')353 v_contact_children.click()354 time.sleep(5)355 parent = pytest.web_driver.window_handles[0]356 chld = pytest.web_driver.window_handles[1]357 pytest.web_driver.switch_to.window(chld)358 title = pytest.web_driver.title359 assert title == 'Лабиринт Дети | VK'360 pytest.web_driver.close()361 pytest.web_driver.switch_to.window(parent)362363 def test_page_bottom_menu_youtube(self):364 scroll_to_bottom(pytest.web_driver)365 youtube = pytest.web_driver.find_element_by_xpath('//a[@data-event-content="Ютьюб"]')366 youtube.click()367 time.sleep(2)368 parent = pytest.web_driver.window_handles[0]369 chld = pytest.web_driver.window_handles[1]370 pytest.web_driver.switch_to.window(chld)371 title = pytest.web_driver.title372 assert title == 'Лабиринт - YouTube'373 pytest.web_driver.close()374 pytest.web_driver.switch_to.window(parent)375376 def test_page_bottom_menu_classmates(self):377 scroll_to_bottom(pytest.web_driver)378 classmates = pytest.web_driver.find_element_by_xpath('//a[@data-event-content="Одноклассники"]')379 classmates.click()380 time.sleep(2)381 parent = pytest.web_driver.window_handles[0]382 chld = pytest.web_driver.window_handles[1]383 pytest.web_driver.switch_to.window(chld)384 title = pytest.web_driver.title385 assert title == 'Лабиринт | Group on OK | Join, read, and chat on OK!'386 pytest.web_driver.close()387 pytest.web_driver.switch_to.window(parent)388389 def test_page_bottom_menu_dzen(self):390 scroll_to_bottom(pytest.web_driver)391 dzen = pytest.web_driver.find_element_by_xpath('//a[@data-event-content="Дзен"]')392 dzen.click()393 time.sleep(2)394 parent = pytest.web_driver.window_handles[0]395 chld = pytest.web_driver.window_handles[1]396 pytest.web_driver.switch_to.window(chld)397 title = pytest.web_driver.title398 assert title == 'Лабиринт | Zen'399 pytest.web_driver.close()400 pytest.web_driver.switch_to.window(parent)401402 def test_page_bottom_menu_telegram(self):403 scroll_to_bottom(pytest.web_driver)404 telegram = pytest.web_driver.find_element_by_xpath('//a[@data-event-content="Телеграм"]')405 telegram.click()406 time.sleep(2)407 parent = pytest.web_driver.window_handles[0]408 chld = pytest.web_driver.window_handles[1]409 pytest.web_driver.switch_to.window(chld)410 title = pytest.web_driver.title411 assert title == 'Telegram: Contact @labirintru'412 pytest.web_driver.close()413 pytest.web_driver.switch_to.window(parent)414415 def test_page_bottom_menu_tiktok(self):416 scroll_to_bottom(pytest.web_driver)417 tiktok = pytest.web_driver.find_element_by_xpath('//a[@data-event-content="ТикТок"]')418 tiktok.click()419 time.sleep(2)420 parent = pytest.web_driver.window_handles[0]421 chld = pytest.web_driver.window_handles[1]422 pytest.web_driver.switch_to.window(chld)423 title = pytest.web_driver.title424 assert title == "labirintru (@labirintru) TikTok | Watch labirintru's Newest TikTok Videos"425 pytest.web_driver.close()426 pytest.web_driver.switch_to.window(parent)427428429class TestPageBottomMenuCatalog: # check bottom links in menu "Каталог"430 def test_page_bottom_menu_allbooks(self):431 scroll_to_bottom(pytest.web_driver)432 allbooks = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a[@data-event-content="Все '433 'книги"]')434 allbooks.click()435 pytest.web_driver.implicitly_wait(2)436 assert pytest.web_driver.find_element_by_xpath(437 '//h1[@class="genre-name"]').text == "Книги"438439 def test_page_bottom_menu_school(self):440 scroll_to_bottom(pytest.web_driver)441 school = pytest.web_driver.find_element_by_xpath(442 '//li[@class="b-rfooter-e-item"]/a[@data-event-content="Школа"]')443 school.click()444 pytest.web_driver.implicitly_wait(2)445 assert pytest.web_driver.find_element_by_xpath(446 '//h1[@class="school-cap__header"]').text == "Все учебники в Лабиринте"447448 def test_page_bottom_menu_journals(self):449 scroll_to_bottom(pytest.web_driver)450 journals = pytest.web_driver.find_element_by_xpath(451 '//li[@class="b-rfooter-e-item"]/a[@data-event-content="Журналы"]')452 journals.click()453 pytest.web_driver.implicitly_wait(2)454 assert pytest.web_driver.find_element_by_xpath('//h1[@class="mag-h1"]').text == "Журнальный лабиринт"455456 def test_page_bottom_menu_games(self):457 scroll_to_bottom(pytest.web_driver)458 games = pytest.web_driver.find_element_by_xpath(459 '//li[@class="b-rfooter-e-item"]/a[@data-event-content="Игрушки"]')460 games.click()461 pytest.web_driver.implicitly_wait(2)462 assert pytest.web_driver.find_element_by_xpath('//h1[@class="genre-name"]').text == "Игры и игрушки"463464 def test_page_bottom_menu_office(self):465 scroll_to_bottom(pytest.web_driver)466 office = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['467 '@data-event-content="Канцтовары"]')468 office.click()469 pytest.web_driver.implicitly_wait(2)470 assert pytest.web_driver.find_element_by_xpath(471 '//h1[@class="genre-name"]').text == "Канцелярские товары"472473 def test_page_bottom_menu_multimedia(self):474 scroll_to_bottom(pytest.web_driver)475 multimedia = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['476 '@data-event-content="CD/DVD"]')477 multimedia.click()478 pytest.web_driver.implicitly_wait(2)479 assert pytest.web_driver.title == "Полная линейка продуктов мультимедиа | Интернет-магазин Лабиринт"480481 def test_page_bottom_menu_souvenir(self):482 scroll_to_bottom(pytest.web_driver)483 souvenir = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['484 '@data-event-content="Сувениры"]')485 souvenir.click()486 pytest.web_driver.implicitly_wait(2)487 assert pytest.web_driver.title == "Сувениры, рамки и альбомы для фотографий, календари и открытки | купить и " \488 "подарить с доставкой | Лабиринт"489490 def test_page_bottom_menu_household(self):491 scroll_to_bottom(pytest.web_driver)492 household = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['493 '@href="/household/"]')494 household.click()495 pytest.web_driver.implicitly_wait(2)496 assert pytest.web_driver.find_element_by_xpath('//h1[@class="genre-name"]').text == "Товары для дома"497498499class TestPageBottomMenuImportant: # check bottom links in menu "Важно"500 def test_page_bottom_menu_actions(self):501 scroll_to_bottom(pytest.web_driver)502 actions = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['503 '@href="/actions/"]')504 actions.click()505 pytest.web_driver.implicitly_wait(2)506 assert pytest.web_driver.title == "Акции, скидки и\xa0подарки в\xa0Интернет-магазине «Лабиринт»."507508 def test_page_bottom_menu_best(self):509 scroll_to_bottom(pytest.web_driver)510 best = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['511 '@data-event-content="Главные книги"]')512 best.click()513 pytest.web_driver.implicitly_wait(2)514 assert pytest.web_driver.find_element_by_xpath(515 '//div[@class="content-block"]/h1').text == "Главные книги 2022"516517 def test_page_bottom_menu_bonus(self):518 scroll_to_bottom(pytest.web_driver)519 bonus = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['520 '@data-event-content="Бонус за рецензию"]')521 bonus.click()522 pytest.web_driver.implicitly_wait(2)523 assert pytest.web_driver.title == "Бонусная программа для рецензентов. Бонус за рецензию"524525 def test_page_bottom_menu_certificates(self):526 scroll_to_bottom(pytest.web_driver)527 certificates = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['528 '@data-event-content="Сертификаты"]')529 certificates.click()530 pytest.web_driver.implicitly_wait(2)531 assert pytest.web_driver.title == 'Сертификаты'532533 def test_page_bottom_menu_only_us(self):534 scroll_to_bottom(pytest.web_driver)535 only_us = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['536 '@data-event-content="Только у нас"]')537 only_us.click()538 pytest.web_driver.implicitly_wait(2)539 assert pytest.web_driver.title == 'Эксклюзивные книги | книжный интернет-магазин Лабиринт'540541 def test_page_bottom_menu_preorder(self):542 scroll_to_bottom(pytest.web_driver)543 preorder = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['544 '@data-event-content="Предзаказы"]')545 preorder.click()546 pytest.web_driver.implicitly_wait(2)547 assert pytest.web_driver.title == 'Предзаказ. Книги, которые мы ждем'548549550class TestPageBottomMenuInteresting: # check bottom links in menu "Интересно"551 def test_page_bottom_menu_now(self):552 scroll_to_bottom(pytest.web_driver)553 now = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['554 '@data-event-content="Лабиринт. Сейчас"]')555 now.click()556 pytest.web_driver.implicitly_wait(2)557 assert pytest.web_driver.find_element_by_xpath(558 '//a[@class="mm-link mm-link-big mm-link-big-m-sub active"]').text == "Лабиринт. Сейчас"559560 def test_page_bottom_menu_child_now(self):561 scroll_to_bottom(pytest.web_driver)562 child_now = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['563 '@data-event-content="Детский навигатор"]')564 child_now.click()565 pytest.web_driver.implicitly_wait(2)566 assert pytest.web_driver.find_element_by_xpath(567 '//a[@class="mm-link mm-link-big mm-link-big-m-sub active"]').text == "Детский навигатор"568569 def test_page_bottom_menu_reviews(self):570 scroll_to_bottom(pytest.web_driver)571 reviews = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['572 '@data-event-content="Рецензии читателей"]')573 reviews.click()574 pytest.web_driver.implicitly_wait(2)575 assert pytest.web_driver.find_element_by_xpath(576 '//a[@class="mm-link mm-link-big mm-link-big-m-sub active"]').text == "Рецензии читателей"577578 def test_page_bottom_menu_book_reviews(self):579 scroll_to_bottom(pytest.web_driver)580 book_reviews = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['581 '@data-event-content="Книжные обзоры"]')582 book_reviews.click()583 pytest.web_driver.implicitly_wait(2)584 assert pytest.web_driver.find_element_by_xpath(585 '//a[@class="mm-link mm-link-big mm-link-big-m-sub active"]').text == "Книжные обзоры"586587 def test_page_bottom_menu_recommendations(self):588 scroll_to_bottom(pytest.web_driver)589 recommendations = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['590 '@data-event-content="Подборки читателей"]')591 recommendations.click()592 pytest.web_driver.implicitly_wait(2)593 assert pytest.web_driver.find_element_by_xpath(594 '//a[@class="mm-link mm-link-big mm-link-big-m-sub active"]').text == "Подборки читателей"595596 def test_page_bottom_menu_tests(self):597 scroll_to_bottom(pytest.web_driver)598 tests = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['599 '@data-event-content="Тесты"]')600 tests.click()601 pytest.web_driver.implicitly_wait(2)602 assert pytest.web_driver.find_element_by_xpath(603 '//a[@class="mm-link mm-link-big mm-link-big-m-sub active"]').text == "Литтесты"604605 def test_page_bottom_menu_news(self):606 scroll_to_bottom(pytest.web_driver)607 news = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['608 '@data-event-content="Новости Л."]')609 news.click()610 pytest.web_driver.implicitly_wait(2)611 assert pytest.web_driver.find_element_by_xpath(612 '//div[@class="ratingh h1"]').text == "Новости Лабиринта"613614 def test_page_bottom_menu_contests(self):615 scroll_to_bottom(pytest.web_driver)616 contests = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['617 '@data-event-content="Конкурсы"]')618 contests.click()619 pytest.web_driver.implicitly_wait(2)620 assert pytest.web_driver.find_element_by_xpath(621 '//a[@class="mm-link mm-link-big mm-link-big-m-sub active"]').text == "Конкурсы"622623 def test_page_bottom_menu_club(self):624 scroll_to_bottom(pytest.web_driver)625 club = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['626 '@data-event-content="Спецпроекты"]')627 club.click()628 pytest.web_driver.implicitly_wait(2)629 title = pytest.web_driver.title630 assert title == 'Книжный клуб интернет-магазина Лабиринт'631632633class TestPageBottomMenuLabAll: # check bottom links in menu "Лабиринт — всем"634 def test_page_bottom_menu_partner(self):635 scroll_to_bottom(pytest.web_driver)636 partner = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['637 '@data-event-content="Партнерам"]')638 partner.click()639 pytest.web_driver.implicitly_wait(2)640 title = pytest.web_driver.title641 assert title == "Партнерская программа Лабиринт.ру"642643 def test_page_bottom_menu_vacancy(self):644 scroll_to_bottom(pytest.web_driver)645 vacancy = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['646 '@data-event-content="Наши вакансии"]')647 vacancy.click()648 time.sleep(2)649 parent = pytest.web_driver.window_handles[0]650 chld = pytest.web_driver.window_handles[1]651 pytest.web_driver.switch_to.window(chld)652 title = pytest.web_driver.title653 assert title == "Издательства Москвы вакансии | Книготорговый и издательский холдинг «Лабиринт»"654 pytest.web_driver.close()655 pytest.web_driver.switch_to.window(parent)656657658class TestPageBottomMenuMyLab: # check bottom links in menu "Мой Лабиринт"659 def test_page_bottom_menu_enter_by_code(self):660 scroll_to_bottom(pytest.web_driver)661 enter_by_code = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['662 '@data-event-content="Войти по коду скидки или через '663 'соцсеть"]')664 enter_by_code.click()665 assert pytest.web_driver.find_element_by_xpath(666 '//div[@class="js-auth__title new-auth__title"]').text == "Полный доступ к Лабиринту"667668 def test_page_bottom_menu_enter(self):669 scroll_to_bottom(pytest.web_driver)670 enter = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['671 '@data-event-content="Вход и регистрация"]')672 enter.click()673 assert pytest.web_driver.find_element_by_xpath(674 '//div[@class="js-auth__title new-auth__title"]').text == "Полный доступ к Лабиринту"675676 def test_page_bottom_menu_visited(self):677 scroll_to_bottom(pytest.web_driver)678 visited = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['679 '@data-event-content="Вы смотрели"]')680 visited.click()681 assert pytest.web_driver.find_element_by_xpath(682 '//li[@class="cabinet-menu__tab cabinet-menu__tab_active"]/a/span').text == "История просмотра"683684 def test_page_bottom_menu_cabinet(self):685 scroll_to_bottom(pytest.web_driver)686 cabinet = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['687 '@data-event-content="Кабинет"]')688 cabinet.click()689 assert pytest.web_driver.find_element_by_xpath(690 '//div[@class="js-auth__title new-auth__title"]').text == "Полный доступ к Лабиринту"691692693class TestPageBottomMenuHelp: # check bottom links in menu "Помощь"694 def test_page_bottom_menu_order(self):695 scroll_to_bottom(pytest.web_driver)696 order = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['697 '@data-event-content="Как сделать заказ"]')698 order.click()699 title = pytest.web_driver.title700 assert title == "Заказ для юридических лиц | Лабиринт"701702 def test_page_bottom_menu_clauser(self):703 scroll_to_bottom(pytest.web_driver)704 clause = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['705 '@data-event-content="Оплата"]')706 clause.click()707 title = pytest.web_driver.title708 assert title == "Оплата | Лабиринт"709 clause132_menu = pytest.web_driver.find_element_by_id('helpmenu132')710 clause_style = clause132_menu.get_attribute('style')711 # print(clause_style[-7:-1])712 assert clause_style[-6:-1] == "block"713714 def test_page_bottom_menu_delivery(self):715 scroll_to_bottom(pytest.web_driver)716 delivery = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['717 '@data-event-content="Доставка"]')718 delivery.click()719 title = pytest.web_driver.title720 assert title == "Помощь | Лабиринт"721722 def test_page_bottom_menu_support(self):723 scroll_to_bottom(pytest.web_driver)724 support = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['725 '@data-event-content="Поддержка"]')726 support.click()727 title = pytest.web_driver.title728 assert title == "Служба поддержки | Поддержка лабиринта"729730 def test_page_bottom_menu_mail_to(self):731 scroll_to_bottom(pytest.web_driver)732 mail_to = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['733 '@data-event-content="Напишите нам"]')734 link = mail_to.get_attribute('href')735 assert link == 'mailto:shop@labirintmail.ru'736 print('\nSend e-mail to:\t', link[7:])737738 def test_page_bottom_menu_all_support(self):739 scroll_to_bottom(pytest.web_driver)740 all_support = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['741 '@data-event-content="Вся помощь"]')742 all_support.click()743 title = pytest.web_driver.title744 assert title == "Помощь | Лабиринт"745746 def test_page_bottom_menu_agreement(self):747 scroll_to_bottom(pytest.web_driver)748 agreement = pytest.web_driver.find_element_by_xpath('//li[@class="b-rfooter-e-item"]/a['749 '@data-event-content="Пользовательское соглашение"]')750 agreement.click()751 title = pytest.web_driver.title752 assert title == "Пользовательское Соглашение об условиях предоставления Услуг в интернет-магазине Лабиринт | " \ ...

Full Screen

Full Screen

message_buffer.py

Source:message_buffer.py Github

copy

Full Screen

...38 """Adds a message into the buffer."""39 self.list_box.add(message)40 # Scroll to the bottom if this is our own message.41 if message.sender == self.room.network.nickname:42 self.scroll_to_bottom(self.list_box)43 44 def on_window_scroll(self, widget, data=None):45 """value-changed signal handler for the window adjustment.46 47 This is used to detect when the user scrolls up, so that we can 48 disconnect the `scroll_to_bottom` handler when we get a new message.49 """50 adj = self.get_vadjustment()51 max_value = adj.get_upper() - adj.get_page_size()52 if adj.get_value() < max_value:53 try:54 self.list_box.disconnect_by_func(self.scroll_to_bottom)55 56 except TypeError:57 pass58 59 else:60 try:61 self.list_box.disconnect_by_func(self.scroll_to_bottom)62 63 except TypeError:64 pass65 self.list_box.connect('size-allocate', self.scroll_to_bottom)66 def scroll_to_bottom(self, widget, data=None):67 """Scroll to the bottom of the buffer."""68 adj = self.get_vadjustment()69 max_value = adj.get_upper() - adj.get_page_size()...

Full Screen

Full Screen

executing_javascript.py

Source:executing_javascript.py Github

copy

Full Screen

1from selenium.common.exceptions import JavascriptException2from webdriver_setup import get_webdriver_for3from time import sleep4driver = get_webdriver_for("firefox")5driver.get("https://www.pythondoctor.com/bopi/")6sleep(1)7# remove header from page8remove_header = """9header = document.getElementsByTagName("header")[0];10header.style.display = "none";11"""12driver.execute_script(remove_header)13sleep(1)14# change the color of background15change_background = "document.body.style.background = '#ccc';"16driver.execute_script(change_background)17sleep(1)18# scroll to bottom of the page19scroll_to_bottom = "window.scrollTo(0, document.body.scrollHeight);"20driver.execute_script(scroll_to_bottom)21sleep(3)22# scrollTo was changed as scrollT to get an exception23try:24 scroll_to_bottom = "window.scrollT(0, document.body.scrollHeight);"25 driver.execute_script(scroll_to_bottom)26except JavascriptException as e:27 print(e)28finally:...

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