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

Blogs

Check out the latest blogs from LambdaTest on this topic:

Feeding your QA Career – Developing Instinctive &#038; Practical Skills

The QA testing profession requires both educational and long-term or experience-based learning. One can learn the basics from certification courses and exams, boot camp courses, and college-level courses where available. However, developing instinctive and practical skills works best when built with work experience.

A Complete Guide To CSS Grid

Ever since the Internet was invented, web developers have searched for the most efficient ways to display content on web browsers.

Keeping Quality Transparency Throughout the organization

In general, software testers have a challenging job. Software testing is frequently the final significant activity undertaken prior to actually delivering a product. Since the terms “software” and “late” are nearly synonymous, it is the testers that frequently catch the ire of the whole business as they try to test the software at the end. It is the testers who are under pressure to finish faster and deem the product “release candidate” before they have had enough opportunity to be comfortable. To make matters worse, if bugs are discovered in the product after it has been released, everyone looks to the testers and says, “Why didn’t you spot those bugs?” The testers did not cause the bugs, but they must bear some of the guilt for the bugs that were disclosed.

A Detailed Guide To Xamarin Testing

Xamarin is an open-source framework that offers cross-platform application development using the C# programming language. It helps to simplify your overall development and management of cross-platform software applications.

How To Run Cypress Tests In Azure DevOps Pipeline

When software developers took years to create and introduce new products to the market is long gone. Users (or consumers) today are more eager to use their favorite applications with the latest bells and whistles. However, users today don’t have the patience to work around bugs, errors, and design flaws. People have less self-control, and if your product or application doesn’t make life easier for users, they’ll leave for a better solution.

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