How to use __select_option method in SeleniumBase

Best Python code snippet using SeleniumBase

broker_manager_gui.py

Source:broker_manager_gui.py Github

copy

Full Screen

...32 ))33 self.current_option = None34 try:35 windows_manager.activate_window('Прозрачный брокер бинарных опционов')36 self.__select_option('EURUSD')37 except RuntimeError:38 pass39 def __set_field(self, field, value):40 pyautogui.doubleClick(**self.config['fields'][field], duration=0.1)41 time.sleep(0.5)42 pyautogui.write(str(value), interval=0.25)43 time.sleep(0.5)44 def __get_field(self, field, use_mouse=False):45 pyperclip.copy("") # <- Это предотвращает замену последней копии текущей копией null.46 pyautogui.doubleClick(**self.config['fields'][field], duration=0.1)47 time.sleep(0.5)48 if use_mouse:49 pyautogui.rightClick(**self.config['fields'][field], duration=0.1)50 time.sleep(0.5)51 pyautogui.moveRel(*self.config['context_menu']['copy'].values(), duration=0.1)52 pyautogui.leftClick()53 else:54 # ctrl-c обычно работает очень быстро, но ваша программа может выполняться быстрее55 pyautogui.hotkey('ctrl', 'c')56 time.sleep(0.5)57 return pyperclip.paste()58 def __select_option(self, option):59 if self.current_option == option:60 return True61 screenshot_region = (62 self.option_buttons[option]['x'] - 5,63 self.option_buttons[option]['y'] - 5,64 self.option_buttons[option]['x'] + 5,65 self.option_buttons[option]['y'] + 566 )67 screenshot_1 = pyautogui.screenshot(region=screenshot_region)68 for k in range(BrokerManagerGui.TRY_COUNT):69 pyautogui.leftClick(**self.option_buttons[option], duration=0.1)70 time.sleep(3)71 screenshot_2 = pyautogui.screenshot(region=screenshot_region)72 if screenshot_1 != screenshot_2:73 logger.debug('Select option {}: SUCCESS'.format(option))74 self.current_option = option75 return True76 logger.debug('Select option {} attempt №{}: FAIL'.format(k, option))77 raise RuntimeError('Can not select option {}'.format(option))78 def get_deal_result(self):79 windows_manager.activate_window('Прозрачный брокер бинарных опционов')80 pyautogui.doubleClick(**self.config['buttons']['opened'], duration=0.1)81 time.sleep(5)82 result = ''83 for k in range(BrokerManagerGui.TRY_COUNT):84 result = self.__get_field('result')85 if result in ['LOSE', 'WIN']:86 break87 time.sleep(5)88 # If result not in ['LOSE', 'WIN'] return as is89 return result90 def make_deal(self, option, prognosis, summ, finish_time):91 windows_manager.activate_window('Прозрачный брокер бинарных опционов')92 self.__select_option(option)93 time.sleep(2)94 real_summ = None95 for k in range(self.TRY_COUNT):96 self.__set_field('investment_money', summ)97 real_summ = self.__get_field('investment_money', use_mouse=True)98 if real_summ == str(summ):99 break100 if real_summ != str(summ):101 raise RuntimeError('Error setting up summ')102 interval = None103 real_interval = None104 for k in range(self.TRY_COUNT):105 interval = int((finish_time - datetime.datetime.now()).total_seconds() / 60)106 self.__set_field('expiration_time', interval)...

Full Screen

Full Screen

menus.py

Source:menus.py Github

copy

Full Screen

...21 for option in self.__options:22 if option["number"] == number:23 return option24 return None25 def __select_option(self):26 try:27 while self.__repeat_select_option:28 option_number = int(input(SELECT_OPTIONS))29 option = self.get_option(option_number)30 if option is None:31 raise InvalidOption(NOT_FOUND_OPTION)32 action = option["action"]33 action.execute()34 if action.repeat_question:35 while action.repeat_question:36 action.execute()37 if not action.repeat_question:38 self.show()39 except Exception as e:40 print(e)41 self.show()42 self.__select_option()43 except KeyboardInterrupt:44 sys.exit()45 def select_option(self):46 try:47 self.show()48 self.__select_option()49 except InvalidOption as e:50 print(e)51 self.__select_option()52 def show(self):53 print(self.__title + ": ")54 for option in self.__options:55 print(f"{option['number']} - {option['title']}", end='\n')56 def add_exit_option(self):...

Full Screen

Full Screen

arg_parse_socket_homework.py

Source:arg_parse_socket_homework.py Github

copy

Full Screen

...15 help='caso queria iniciar o cliente utilzie -client')16 return parser17 def parse(self):18 args = self.__parser.parse_args()19 self.__select_option(args.server, args.client)20 def __select_option(self, server_option: bool, client_option: bool):21 if server_option and client_option:22 raise Exception('Só pode iniciar o server ou o client')23 elif server_option is True:24 self.__start_server_callback()25 elif client_option is True:26 self.__start_client_callback()27 else:...

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