How to use moveRel method in fMBT

Best Python code snippet using fMBT_python

main.py

Source:main.py Github

copy

Full Screen

...16 wait_for_screen_then_click_or_exit('leasing', 'failed to open buildium leasing tab')17 wait_for_screen_then_click_or_exit('applicants', 'failed to open buildium applicants tab',18 x = lambda : [19 move_to('applicants'),20 pag.moveRel(1, 1, .1),21 pag.moveRel(-1, -1, .1)])22 # We might already have a filter, in which case we remove it23 if wait_for_screen_or_clean_up('clear_existing_filter', 'no existing filter to clear', timeout_seconds = 15, 24 x = lambda : [25 move_to('clear_existing_filter'),26 pag.moveRel(1, 1, .1),27 pag.moveRel(-1, -1, .1)],28 clean_func = lambda : None):29 mouse_click('clear_existing_filter')30 wait_for_screen_then_click_or_exit('add_filter_option', 'failed to open filter option',31 x = lambda : [32 move_to('add_filter_option'),33 pag.moveRel(1, 1, .1),34 pag.moveRel(-1, -1, .1)])35 wait_for_screen_then_click_or_exit('filter_by_applicant', 'failed to click on applicant under add filter option dropdown',36 x = lambda : [37 move_to('filter_by_applicant'),38 pag.moveRel(1, 1, .1),39 pag.moveRel(-1, -1, .1)])40 sleep(1)41 keyboard(first)42 keyboard(' ')43 keyboard(last)44 press('enter')45 sleep(1)46 wait_for_screen_then_click_or_exit('applicant_row', 'failed to find applicant name',47 x = lambda : [48 move_to('applicant_row'),49 pag.moveRel(1, 1, .1),50 pag.moveRel(-1, -1, .1)])51# return a list of file names that we saved the screenshots in52def take_screenshots(first, last, start_fn_index = 0):53 clicks = application_coords['scroll_click_count']54 55 count = start_fn_index56 extension = '.png'57 base_fn = '{}_{}'.format(first, last)58 folder = '/home/tgaldes/Pictures/'59 breaking = False60 fns = []61 while True: # TODO: look for bar in lower right corner all the way at the bottom62 screen = pag.screenshot()63 fn = folder + base_fn + '_' + str(count) + extension64 screen.save(fn)65 fns.append(fn)66 count += 167 for i in range(clicks):68 mouse_click('bottom_right_down_button')69 if breaking:70 break71 if wait_for_screen_or_clean_up('bottom_right', 'still not done taking screenshots', clean_func = lambda : None, timeout_seconds = 1):72 breaking = True73 elif wait_for_screen_or_clean_up('no_bottom_right_scroll_bar', 'there is a scroll bar', clean_func = lambda : None, timeout_seconds = 1):74 break75 return fns76def get_screening(first, last):77 open_applicant(first, last)78 if wait_for_screen_or_clean_up('tenant_page_loaded', 'blue box on tenant page didnt load'):79 mouse_click('tenant_screening')80 '''wait_for_screen_then_click_or_exit('tenant_screening', 'could not click on first screening button',81 x = lambda : [82 move_to('tenant_screening'),83 pag.moveRel(1, 1, .1),84 pag.moveRel(-1, -1, .1)])'''85 start_fn_index = 086 all_fns = []87 for page_link, page in [('credit_report_link', 'credit_report'), ('criminal_report_link', 'criminal_report'), ('evictions_report_link', 'evictions_report')]:88 # load the landing page89 if not wait_for_screen_or_clean_up('decline', 'could not find gray decline button', clean_func = lambda : None, target_color_names=['decline, decline_alt']) \90 and not \91 wait_for_screen_or_clean_up('conditional', 'could not find gray conditional button', target_color_names=['conditional, conditional_alt']):92 return93 # click on the page we want94 mouse_click(page_link)95 # let that page load (look for light blue areas)96 wait_for_screen_or_exit(page, 'could not load {}'.format(page),97 x = lambda : [98 move_to(page),99 pag.moveRel(1, 1, .1),100 pag.moveRel(-1, -1, .1)])101 fns = take_screenshots(first, last, start_fn_index)102 all_fns.extend(fns)103 start_fn_index += len(fns)104 print(all_fns)105 mouse_click('back_on_browser')106 print(all_fns)107 clean_up(0)108 return all_fns109 110def process_application(first, last):111 open_applicant(first, last)112 # Charge their credit card113 wait_for_screen_then_click_or_exit('process_fee', 'failed to find process fee button at start of credit card screening',114 x = lambda : [115 move_to('process_fee'),116 pag.moveRel(1, 1, .1),117 pag.moveRel(-1, -1, .1)])118 wait_for_screen_then_click_or_exit('green_process_fee', 'failed to find green process fee button before charging credit card',119 x = lambda : [120 move_to('green_process_fee'),121 pag.moveRel(1, 1, .1),122 pag.moveRel(-1, -1, .1)])123 # Now we expect the charge to be pending124 wait_for_screen_or_clean_up('pending_process_fee', 'fee not marked as pending', timeout_seconds = 30, 125 clean_func = lambda : None)126 # Do the screening127 wait_for_screen_then_click_or_exit('tenant_screening', 'could not click on first screening button',128 x = lambda : [129 move_to('tenant_screening'),130 pag.moveRel(1, 1, .1),131 pag.moveRel(-1, -1, .1)])132 wait_for_screen_then_click_or_exit('green_tenant_screening', 'could not click on second screening button',133 x = lambda : [134 move_to('green_tenant_screening'),135 pag.moveRel(1, 1, .1),136 pag.moveRel(-1, -1, .1)])137 # Now let the page load138 wait_for_screen_or_exit('green_review_order', 'never found green review order button before entering in rent and deposit values',139 x = lambda : [140 move_to('green_review_order'),141 pag.moveRel(1, 1, .1),142 pag.moveRel(-1, -1, .1)])143 mouse_click('monthly_rent')144 keyboard('900')145 mouse_click('security_deposit')146 keyboard('900')147 mouse_click('charge_my_buildium_account')148 wait_for_screen_or_exit('charge_my_buildium_account', 'failed to click on charge my buildium account')149 wait_for_screen_then_click_or_exit('green_review_order', 'failed to click on review order button',150 x = lambda : [151 move_to('green_review_order'),152 pag.moveRel(1, 1, .1),153 pag.moveRel(-1, -1, .1)])154 # Now let the page load155 wait_for_screen_or_exit('place_order', 'final confirm credit check screen didn\'t load',156 x = lambda : [157 move_to('place_order'),158 pag.moveRel(1, 1, .1),159 pag.moveRel(-1, -1, .1)])160 mouse_click('authorize_charge')161 wait_for_screen_or_exit('authorize_charge', 'never found button to authorize charge',162 x = lambda : [163 move_to('authorize_charge'),164 pag.moveRel(1, 1, .1),165 pag.moveRel(-1, -1, .1)])166 wait_for_screen_then_click_or_exit('place_order', 'failed while attempting to click on place order',167 x = lambda : [168 move_to('place_order'),169 pag.moveRel(1, 1, .1),170 pag.moveRel(-1, -1, .1)])171 clean_up(0)172if __name__=='__main__':173 if len(sys.argv) < 4:174 print('No function, first, or last name passed to process_application.')175 exit(1)176 function, first, last = sys.argv[1], sys.argv[2], sys.argv[3]177 init(application_coords, application_colors) # give constants to utils178 179 if function == 'application':180 process_application(first, last)181 exit(0)182 elif function == 'screening':183 get_screening(first, last)184 exit(0)...

Full Screen

Full Screen

pyautogui案例.py

Source:pyautogui案例.py Github

copy

Full Screen

...49 pyautogui.dragRel(0, -90, duration=0.25)50 pyautogui.dragRel(100, 0, duration=0.25)51 pyautogui.dragRel(0, 90, duration=0.25)52 pyautogui.dragRel(-100, 0, duration=0.25)53 pyautogui.moveRel(50, 0, duration=0.25)54 pyautogui.dragRel(0, -90, duration=0.25)55 pyautogui.moveRel(-50, 30, duration=0.25)56 pyautogui.dragRel(25, 0, duration=0.25)57 pyautogui.moveRel(50, 0, duration=0.25)58 pyautogui.dragRel(0, 30, duration=0.25)59 pyautogui.moveRel(-25, 0, duration=0.25)60 pyautogui.dragRel(-25, 0, duration=0.25)61 pyautogui.moveRel(0, 30, duration=0.25)62 pyautogui.dragRel(0, 90, duration=0.25)63 pyautogui.dragRel(-50, 0, duration=0.25)64 pyautogui.dragRel(0, -90, duration=0.25)65 pyautogui.dragRel(25, 0, duration=0.25)66 pyautogui.moveRel(0, 30, duration=0.25)67 pyautogui.dragRel(50, 0, duration=0.25)68 pyautogui.moveRel(-25, 60, duration=0.25)69 pyautogui.dragRel(100, 0, duration=0.25)70 pyautogui.dragRel(0, -90, duration=0.25)71 pyautogui.dragRel(-50, 0, duration=0.25)72 pyautogui.dragRel(0, 90, duration=0.25)73 pyautogui.moveRel(25, -60, duration=0.25)74 pyautogui.dragRel(0, 30, duration=0.25)75 pyautogui.moveRel(-25, 0, duration=0.25)76 pyautogui.dragRel(-25, 0, duration=0.25)77 pyautogui.moveRel(-50, 0, duration=0.25)78 pyautogui.dragRel(-25, 0, duration=0.25)79 pyautogui.moveRel(0, 30, duration=0.25)80 pyautogui.dragRel(-25, 0, duration=0.25)81 pyautogui.dragRel(0, 90, duration=0.25)82 pyautogui.dragRel(200, 0, duration=0.25)83 pyautogui.dragRel(0, -90, duration=0.25)84 pyautogui.dragRel(-25, 0, duration=0.25)85 pyautogui.moveRel(-25, 0, duration=0.25)86 pyautogui.dragRel(0, 90, duration=0.25)87 pyautogui.moveRel(-50, 0, duration=0.25)88 pyautogui.dragRel(0, -90, duration=0.25)89 pyautogui.moveRel(-50, 0, duration=0.25)90 pyautogui.dragRel(0, 90, duration=0.25)91 # 992 pyautogui.moveRel(-25, -15, duration=0.25)93 pyautogui.dragRel(0, -15, duration=0.25)94 pyautogui.dragRel(-25, 0, duration=0.25)95 pyautogui.moveRel(25, -30, duration=0.25)96 pyautogui.dragRel(0, -15, duration=0.25)97 # 498 pyautogui.moveRel(50, -15, duration=0.25)99 pyautogui.dragRel(0, 60, duration=0.25)100 pyautogui.moveRel(-22, 27, duration=0.25)101 pyautogui.dragRel(22, 0, duration=0.25)102 pyautogui.moveRel(22, 0, duration=0.25)103 pyautogui.dragRel(0, -12, duration=0.25)104 pyautogui.moveRel(0, -12, duration=0.25)105 pyautogui.dragRel(0, -60, duration=0.25)106 # 2107 pyautogui.moveRel(3, 30, duration=0.25)108 pyautogui.dragRel(25, 0, duration=0.25)109 pyautogui.moveRel(0, 30, duration=0.25)110 pyautogui.dragRel(25, 0, duration=0.25)111 # 0112 pyautogui.moveRel(25, 0, duration=0.25)113 pyautogui.dragRel(0, -30, duration=0.25)114 #115 pyautogui.moveRel(25, 57, duration=0.25)116 pyautogui.dragRel(25, 0, duration=0.25)117 pyautogui.dragRel(0, 90, duration=0.25)118 pyautogui.dragRel(-250, 0, duration=0.30)119 pyautogui.dragRel(0, -90, duration=0.25)120 pyautogui.dragRel(25, 0, duration=0.25)121 pyautogui.moveRel(25, 0, duration=0.25)122 pyautogui.dragRel(0, 90, duration=0.25)123 pyautogui.moveRel(50, 0, duration=0.25)124 pyautogui.dragRel(0, -90, duration=0.25)125 pyautogui.moveRel(50, 0, duration=0.25)126 pyautogui.dragRel(0, 90, duration=0.25)127 pyautogui.moveRel(50, 0, duration=0.25)128 pyautogui.dragRel(0, -90, duration=0.25)129 # 5130 pyautogui.moveRel(-150, 30, duration=0.25)131 pyautogui.dragRel(-25, 0, duration=0.25)132 pyautogui.moveRel(0, 30, duration=0.25)133 pyautogui.dragRel(-25, 0, duration=0.25)134 # 9135 pyautogui.moveRel(50, 0, duration=0.25)136 pyautogui.dragRel(25, 0, duration=0.25)137 pyautogui.dragRel(0, 15, duration=0.25)138 pyautogui.moveRel(0, -45, duration=0.25)139 pyautogui.dragRel(0, -15, duration=0.25)140 # 4 2 0141 # 4142 pyautogui.moveRel(50, -15, duration=0.25)143 pyautogui.dragRel(0, 60, duration=0.25)144 pyautogui.moveRel(-22, 27, duration=0.25)145 pyautogui.dragRel(22, 0, duration=0.25)146 pyautogui.moveRel(22, 0, duration=0.25)147 pyautogui.dragRel(0, -12, duration=0.25)148 pyautogui.moveRel(0, -12, duration=0.25)149 pyautogui.dragRel(0, -60, duration=0.25)150 # 2151 pyautogui.moveRel(3, 30, duration=0.25)152 pyautogui.dragRel(25, 0, duration=0.25)153 pyautogui.moveRel(0, 30, duration=0.25)154 pyautogui.dragRel(25, 0, duration=0.25)155 # 0156 pyautogui.moveRel(25, 0, duration=0.25)157 pyautogui.dragRel(0, -30, duration=0.25)158if __name__ == '__main__':159 # 绘制数字520160 func()161 # 绘制方块...

Full Screen

Full Screen

testing.py

Source:testing.py Github

copy

Full Screen

...14from bot import BotState15def mineStaight():16 time.sleep(.5)17 pydirectinput.leftClick()18 pydirectinput.moveRel(None, -400)19 time.sleep(.5)20 pydirectinput.moveRel(None, 400)21 pydirectinput.leftClick()22 pydirectinput.press('w', 2)23 time.sleep(2.0)24def turn180():25 pydirectinput.moveRel(300, None)26 pydirectinput.moveRel(300, None)27 pydirectinput.moveRel(300, None)28 pydirectinput.moveRel(300, None)29def checkY(img):30 return(False)31def mineDiag():32 pydirectinput.leftClick()33 pydirectinput.moveRel(None, -400)34 time.sleep(.5)35 pydirectinput.moveRel(None, -400)36 pydirectinput.leftClick()37 time.sleep(.5)38 pydirectinput.moveRel(None, 800)39 pydirectinput.leftClick()40 pydirectinput.press('w', 2)41 time.sleep(2.0)42wincap = WindowCapture('Minecraft 1.17.1 - Singleplayer')43torchcount = 0;44wcount = 045while True:46 time.sleep(1.0)47 mineStaight()48 torchcount +=149 wcount +=150 if torchcount>=3:51 pydirectinput.moveRel(600, None)52 pydirectinput.rightClick()53 pydirectinput.moveRel(-600, None)54 torchcount = 055 #pydirectinput.moveRel(100, None)56 #pydirectinput.mouseDown()57 #pydirectinput.keyUp('w')58 if keyboard.is_pressed('u'):59 pydirectinput.mouseUp()60 turn180()61 for x in range(wcount):62 pydirectinput.press('w', 2)63 time.sleep(.5)...

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