How to use hover_and_click method in SeleniumBase

Best Python code snippet using SeleniumBase

qa_interview.py

Source:qa_interview.py Github

copy

Full Screen

...24 # self._test_network(),25 # Developers26 # self._test_developers(),27 def _test_apps_ios(self):28 self.hover_and_click('.nav-menu li:first-child', '.nav-menu li:first-child .sub-menu li:first-child a'),29 self.assert_title("Speedtest for iOS - Download Speedtest for the iPhone and iPad on the App Store"),30 self.assert_no_404_errors()31 def _test_insights_blog(self):32 self.hover_and_click('.nav-menu > li:nth-child(2)', '.nav-menu > li:nth-child(2) .sub-menu li:first-child a'),33 self.assert_title("Speedtest Stories & Analysis: Data-driven articles on internet speeds"),34 self.assert_no_404_errors()35 def _test_network(self):36 self.click_link('Network'),37 self.assert_title("Speedtest Servers | Ookla"),38 self.assert_no_404_errors()39 def _test_developers(self):40 self.click_link("Developers"),41 self.assert_title("Speedtest CLI - Internet connection measurement for developers"),42 self.assert_no_404_errors()43 def _test_setting_changes_stay_after_navigate_away(self):44 # Under the Log In button menu, go to Settings45 self.hover_and_click('.nav-menu > li:nth-child(7)', '.nav-menu > li:nth-child(7) .sub-menu > li:nth-child(2) a'),46 # switch to 24-hr global settings from 1247 self.click('#global-settings-form .radio-label-input input[type=radio]+label[for="2"]'),48 # Set Distance to Kilometers49 self.click('.radio-label-input input[type=radio]+label[for="kilometers"]'),50 # navigate away and go back and assert:51 # the changes are still 24 hours52 self.click('.nav-menu > li:nth-child(4) a'),53 self.hover_and_click('.nav-menu > li:nth-child(7)', '.nav-menu > li:nth-child(7) .sub-menu > li:nth-child(2) a'),54 self.is_checked('.radio-label-input input[type=radio][value="2"]'),55 # and the Distance is set to Kilometers.56 self.is_checked('.radio-label-input input[type=radio][value="kilometers"]')57 def _run_speed_test(self):58 self.click('.start-button a.js-start-test'),59 # close the pop up ads after the speed run complete60 self.click('.desktop-app-prompt-modal a.notification-dismiss.close-btn', timeout=60),61 # result should have download speed62 self.assert_element('.result-item-download span.download-speed'),63 # result should have ping64 self.assert_element('.result-item-ping span.ping-speed'),65 # result should have upload speed66 self.assert_element('.result-item-upload span.upload-speed')67 def _test_results_history(self):68 self.hover_and_click('.nav-menu > li:nth-child(7)', '.nav-menu > li:nth-child(7) .sub-menu > li:first-child a'),69 # confirm there is one result70 self.assert_element('.result-row'),71 # take a screenshot of the results page...

Full Screen

Full Screen

Navigation.py

Source:Navigation.py Github

copy

Full Screen

...5 import cv26 import numpy as np7 import time8 from . import HandTracks as ht9 def hover_and_click(status, click, x, y):10 if status:11 pyautogui.moveTo(x, y, duration=0.05) 12 #time.sleep(random.uniform(0.001, 0.003))13 if click:14 pyautogui.click(x=x, y=y, clicks=1, button='left')15 def standard_scroll(key='down'):16 if key == 'down':17 pyautogui.scroll(-20)18 else:19 pyautogui.scroll(20)20 # Defining parameters for image processing21 width, height = 1000, 100022 fr = 10023 smooth = 724 # Defining some aesthetic characteristics25 radius = 1026 c_colour = (153, 50, 204)27 #Screen size28 global wScr29 wScr, hScr = pyautogui.size()30 wCam, hCam = 640, 48031 # Turn on Camera and set resolution32 cap = cv2.VideoCapture(0)33 cap.set(3, width)34 cap.set(4, height)35 # Using mediapipe to locate hands36 hand_map = ht.detect_hands(hand_count=1)37 # finger tip ids38 tips = [4, 8, 12, 16, 20]39 status = True40 X, Y = cX, cY = 0, 041 # Capture Image42 t1 = time.time()43 while True:44 #print ("Current position: " + str(mouse.position))45 success, frames = cap.read()46 frame = cv2.flip(frames, 1)47 frame = cv2.resize(frame,(int(wScr), int(hScr))) #(48 # Draw hand landmarks49 frame = hand_map.locate_hands(frame)50 # Find Landmarks on hand51 landmarks = hand_map.find_finger_positions(frame, 0)52 if len(landmarks) != 0: # If Hand Detected53 # Index Finger's coordinates54 index_x, index_y = landmarks[1][1:]55 # Middle Finger's coordinates56 middle_x, middle_y = landmarks[2][1:]57 # To check the fingers that are up58 up_fingers = hand_map.many_fingers_up()59 # Draw Gesture : Index Finger must be up and middle finger must be down60 if up_fingers[1] == 1 and up_fingers[2] == 0:61 hover_and_click(True, False, index_x, index_y)62 if up_fingers[1] == 1 and up_fingers[2] == 1:63 if time.time() - t1 > 2:64 hover_and_click(True, True, index_x, index_y)65 t1 = time.time()66 l1, img1 = hand_map.calc_dis(tips[0], tips[1], frame)67 if l1 < 10:68 status = False69 if not status:70 if up_fingers[0] == up_fingers[1] == up_fingers[2] == up_fingers[3] == up_fingers[4] == 1:71 status = True72 else:73 l2, img2 = hand_map.calc_dis(tips[0], tips[1], frame)74 if l2 > 40:75 standard_scroll()76 else:77 standard_scroll('up')78 cv2.imshow('Hand Tracker', frame)...

Full Screen

Full Screen

main_page.py

Source:main_page.py Github

copy

Full Screen

...14 def go_to(self, type_):15 if type_ == 'python':16 self.click(self.locators.GO_TO_PYTHON)17 elif type_ == 'python_history':18 self.hover_and_click(menu_locator=self.locators.GO_TO_PYTHON,19 submenu_locator=self.locators.GO_TO_PYTHON_HISTORY)20 elif type_ == 'flask':21 self.hover_and_click(menu_locator=self.locators.GO_TO_PYTHON, submenu_locator=self.locators.GO_TO_FLASK)22 elif type_ == 'centos':23 self.hover_and_click(menu_locator=self.locators.LINUX, submenu_locator=self.locators.GO_TO_CENTOS)24 elif type_ == 'wireshark_news':25 self.hover_and_click(menu_locator=self.locators.NETWORK, submenu_locator=self.locators.GO_TO_WIRESHARK_NEWS)26 elif type_ == 'wireshark_download':27 self.hover_and_click(menu_locator=self.locators.NETWORK,28 submenu_locator=self.locators.GO_TO_WIRESHARK_DOWNLOAD)29 elif type_ == 'tcp_examples':30 self.hover_and_click(menu_locator=self.locators.NETWORK, submenu_locator=self.locators.GO_TO_TCP_EXAMPLES)31 elif type_ == 'API':32 self.click(self.locators.GO_TO_WHAT_API)33 elif type_ == 'future':34 self.click(self.locators.GO_TO_FUTURE)35 elif type_ == 'SMTP':36 self.click(self.locators.GO_TO_SMTP)37 def check_title(self, text):38 return text in self.driver.title...

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