How to use screen_should_not_contain method in robotframework-androidlibrary

Best Python code snippet using robotframework-androidlibrary_python

SikuliKeywordHelper.py

Source:SikuliKeywordHelper.py Github

copy

Full Screen

1from SikuliLibrary import sikuli2import os3class SikuliKeywordHelper:4 os.environ["DISABLE_SIKULI_LOG"] = 'True'5 lib = sikuli.SikuliLibrary()6 def Add_Image_Path(self, path):7 """8 Add image path9 """10 args = [path]11 return self.lib.run_keyword('addImagePath', args)12 def Capture_Region(self, *coordinates):13 """14 Capture region15 Capture region passed16 Examples:17 | ${screenshotname}= | Capture region | [x, y, w, h] |18 """19 args = [coordinates]20 return self.lib.run_keyword('captureRegion', args)21 def Capture_Roi(self):22 """23 Capture Roi24 """25 args = []26 return self.lib.run_keyword('captureRoi', args)27 def Capture_Screen(self):28 """29 Capture whole screen, file name is returned30 """31 args = []32 return self.lib.run_keyword('captureScreen', args)33 def Change_Screen_Id(self, screenId):34 """35 Change screen id36 For multi display, user could use this keyword to switch to the correct screen37 Examples:38 | Change screen id | 1 |39 """40 args = [screenId]41 return self.lib.run_keyword('changeScreenId', args)42 def Clear_All_Highlights(self):43 """44 Clear all highlights from screen45 """46 args = []47 return self.lib.run_keyword('clearAllHighlights', args)48 def Clear_Highlight(self, image):49 """50 Clear highlight from screen51 """52 args = [image]53 return self.lib.run_keyword('clearHighlight', args)54 def Click_Using_Image(self, image, xOffset=0, yOffset=0):55 """56 Click57 Click on an image with similarity and offset.58 Examples:59 | Set Capture Matched Image | false |60 """61 args = [image, xOffset, yOffset]62 return self.lib.run_keyword('click', args)63 def Click_In(self, areaImage, targetImage):64 """65 Click in.66 Click target image in area image.67 """68 args = [areaImage, targetImage]69 return self.lib.run_keyword('clickIn', args)70 def Click_Nth(self, image, index, similarity, sortByColumn=True):71 """72 Click nth73 Click on specific image.74 Optionally pass similarity and sort by column or row.75 Examples:76 | Click on nth image in region | image.png | 1 | 0.9 |77 | Click on nth image in region | image.png | 1 | 0.9 | ${FALSE} |78 """79 args = [image, index, similarity, sortByColumn]80 return self.lib.run_keyword('clickNth', args)81 def Click_Region(self, coordinates, waitChange=0, timeout=0):82 """83 Click region84 Click on defined region coordinates.85 Optionally Wait for specified time to ensure region has changed.86 Also, optionally set highlight87 Examples:88 | Click on region | [x,y,w,h] | image.png |89 | Click on region | [x,y,w,h] | image.png | 0 |90 | Click on region | [x,y,w,h] | image.png | 0 | 2 |91 """92 args = [coordinates, waitChange, timeout]93 return self.lib.run_keyword('clickRegion', args)94 def Click_Text_Using_Image(self, text):95 """96 Click Text97 Click on text.98 Examples:99 | Click Text | Hello |100 """101 args = [text]102 return self.lib.run_keyword('clickText', args)103 def Close_Application(self, name):104 """105 Close application106 """107 args = [name]108 return self.lib.run_keyword('closeApplication', args)109 def Double_Click_Using_Image(self, image, xOffset=0, yOffset=0):110 """111 Double click112 """113 args = [image, xOffset, yOffset]114 return self.lib.run_keyword('doubleClick', args)115 def Double_Click_In(self, areaImage, targetImage):116 """117 Double click in.118 Double click target image in area image.119 """120 args = [areaImage, targetImage]121 return self.lib.run_keyword('doubleClickIn', args)122 def Drag_And_Drop_Using_Image(self, srcImage, targetImage):123 """124 Drag the source image to target image.125 If source image is empty, drag the last match and drop at given target126 """127 args = [srcImage, targetImage]128 return self.lib.run_keyword('dragAndDrop', args)129 def Drag_And_Drop_By_Offset(self, srcImage, xOffset, yOffset):130 """131 Drag the source image to target by offset.132 If source image is empty, drag the last match and drop at given target133 """134 args = [srcImage, xOffset, yOffset]135 return self.lib.run_keyword('dragAndDropByOffset', args)136 def Image_Exists(self, image, timeout=10):137 """138 Exists139 Check whether image exists in screen140 @image: expected image in screen141 @timeout: wait seconds142 Examples:143 | ${is_exist}= | Exists | image.png | 0 |144 """145 args = [image, timeout]146 return self.lib.run_keyword('exists', args)147 def All_Image_Exists(self,images,timeout=10):148 for image in images:149 is_present = self.Image_Exists(image,timeout)150 if not is_present:151 return False152 return True153 def Get_Current_Screen_Id(self):154 """155 Get current screen id156 """157 args = []158 return self.lib.run_keyword('getCurrentScreenId', args)159 def Get_Extended_Region_From(self, image, direction, number_of_times_to_repeat):160 """161 Get extended region from162 Extended the given image creating a region above or below with the same width163 The height can change using the multiplier @number_of_times_to_repeat,164 if 2 is given the new region will have twice the height of the original165 """166 args = [image, direction, number_of_times_to_repeat]167 return self.lib.run_keyword('getExtendedRegionFrom', args)168 def Get_Image_Coordinates(self, image, *coordinates):169 """170 Get Image Coordinates171 Return image coordinates, within region172 Examples:173 | ${imageCoordinates}= | Get Image Coordinates | image.png=0.75 |174 | ${imageCoordinates}= | Get Image Coordinates | image.png=0.75 | [x, y, w, z] |175 """176 args = [image, coordinates]177 return self.lib.run_keyword('getImageCoordinates', args)178 def Get_Match_Score(self, image):179 """180 Get match score181 Tries to find the image on the screen, returns accuracy score (0-1)182 Examples:183 | ${score} = | Get Match Score | somethingThatMayExist.png |184 | Run Keyword if | ${score} > 0.95 | keyword1 | ELSE | keyword2 |185 """186 args = [image]187 return self.lib.run_keyword('getMatchScore', args)188 def Get_Number_Of_Screens(self):189 """190 Get number of screens191 """192 args = []193 return self.lib.run_keyword('getNumberOfScreens', args)194 def Get_Screen_Coordinates(self):195 """196 Get screen coordinates197 Return screen coordinates for active screen198 Examples:199 | @{coordinates}= | Get Screen Coordinates | 0 |200 """201 args = []202 return self.lib.run_keyword('getScreenCoordinates', args)203 def Get_Text_Using_Image(self, image=''):204 """205 Get text206 If image is not given, keyword will get text from whole Screen207 If image is given, keyword will get text from matched region208 Call keyword setOcrTextRead to set OcrTextRead as true, before using text recognition keywords209 Examples:210 | Set Ocr Text Read | true |211 | Get Text |212 | Get Text | test.png |213 """214 args = []215 if image.strip() != '':216 args.append(image)217 return self.lib.run_keyword('getText', args)218 def Highlight(self, image, secs=0):219 """220 Highlight matched image.221 If secs is set, highlight will vanish automatically after set seconds222 """223 args = [image, secs]224 return self.lib.run_keyword('highlight', args)225 def Highlight_Region(self, *coordinates, timeout):226 """227 Highlight region228 """229 args = [coordinates, timeout]230 return self.lib.run_keyword('highlightRegion', args)231 def Highlight_Roi(self, timeout):232 """233 Highlight ROI234 """235 args = [timeout]236 return self.lib.run_keyword('highlightRoi', args)237 def Image_Count(self, steps, image=''):238 """239 Image Count240 Count how many times the same picture is detected in screen.\241 Examples:242 | ${image_cnt}= | Image Count | test.png |243 """244 args = [steps, image]245 return self.lib.run_keyword('imageCount', args)246 def Input_Text_Using_Image(self, image, text):247 """248 Input text249 Image could be empty250 Examples:251 | Input text | Sikuli |252 """253 args = [image, text]254 return self.lib.run_keyword('inputText', args)255 def Mouse_Down_Using_Image(self, *mouseButtons):256 """257 Mouse down258 Press and hold the specified buttons259 @mouseButtons: Could be LEFT, MIDDLE, RIGHT260 Examples:261 | Mouse Move | test.png |262 | Mouse Down | LEFT | RIGHT |263 | Mouse Up |264 """265 args = [mouseButtons]266 return self.lib.run_keyword('mouseDown', args)267 def Mouse_Move_Using_Image(self, image=''):268 """269 Mouse moveMove the mouse pointer to the target270 @image: if image is empty, will move mouse to the last matched.271 Examples:272 | Mouse Move | test.png |273 | Screen Should Contain | test.png |274 | Mouse Move |275 """276 args = [image]277 return self.lib.run_keyword('mouseMove', args)278 def Mouse_Up_Using_Image(self, *mouseButtons):279 """280 Mouse up281 Release the specified mouse buttons282 @mouseButtons: Could be LEFT, MIDDLE, RIGHT. If empty, all currently held buttons are released283 Examples:284 | Mouse Move | test.png |285 | Mouse Down | LEFT | RIGHT |286 | Mouse Up | LEFT | RIGHT |287 """288 args = [mouseButtons]289 return self.lib.run_keyword('mouseUp', args)290 def Open_Application(self, path):291 """292 Open application293 To open app with parameters, refer:294 https://sikulix-2014.readthedocs.io/en/latest/appclass.html#App.App295 """296 args = [path]297 return self.lib.run_keyword('openApplication', args)298 def Paste_Text_Using_Image(self, image, text):299 """300 Paste text. Image could be empty301 """302 args = [image, text]303 return self.lib.run_keyword('pasteText', args)304 def Press_Special_Key(self, keyConstant):305 """306 Press special key307 Presses a special keyboard key.308 For a list of possible Keys view docs for org.sikuli.script.Key .309 Examples:310 | Double Click | textFieldWithDefaultText.png |311 | Press Special Key | DELETE |312 """313 args = [keyConstant]314 return self.lib.run_keyword('pressSpecialKey', args)315 def Read_Text_From_Region(self, reg):316 """317 Read text from region318 """319 args = [reg]320 return self.lib.run_keyword('readTextFromRegion', args)321 def Remove_Image_Path(self, path):322 """323 Remove image path324 """325 args = [path]326 return self.lib.run_keyword('removeImagePath', args)327 def Reset_Roi(self):328 """329 Reset ROI330 Set Region of interest to full screen331 Examples:332 | Reset roi |333 """334 args = []335 return self.lib.run_keyword('resetRoi', args)336 def Right_Click(self, image):337 """338 Right click339 """340 args = [image]341 return self.lib.run_keyword('rightClick', args)342 def Right_Click_In(self, areaImage, targetImage):343 """344 Right click in.345 Right click target image in area image.346 """347 args = [areaImage, targetImage]348 return self.lib.run_keyword('rightClickIn', args)349 def Screen_Should_Contain(self, image):350 """351 Screen should contain352 """353 args = [image]354 return self.lib.run_keyword('screenShouldContain', args)355 def Screen_Should_Not_Contain(self, image):356 """357 Screen should not contain358 Screen should not contain image359 Examples:360 | Screen should not contain | image.png |361 """362 args = [image]363 return self.lib.run_keyword('screenShouldNotContain', args)364 def Select_Region(self, message):365 """366 Select Region367 Allow user to select a region and capture it.368 Return array of [capturedImagePath, x, y, w, h]369 Examples:370 | @{SelectedRegion}= | Select region |371 """372 args = [message]373 return self.lib.run_keyword('selectRegion', args)374 def Set_Capture_Folder(self, path):375 """376 Set captured folder377 Set folder for captured images378 Examples:379 | Set captured folder | PATH |380 """381 args = [path]382 return self.lib.run_keyword('setCaptureFolder', args)383 def Set_Capture_Matched_Image(self, value):384 """385 Set capture matched image386 Set capture matched images, the default value is true387 Examples:388 | Set Capture Matched Image | false |389 """390 args = [value]391 return self.lib.run_keyword('setCaptureMatchedImage', args)392 def Set_Min_Similarity(self, minSimilarity):393 """394 Set min similarity395 """396 args = [minSimilarity]397 return self.lib.run_keyword('setMinSimilarity', args)398 def Set_Move_Mouse_Delay(self, delay):399 """400 Set move mouse delay401 """402 args = [delay]403 return self.lib.run_keyword('setMoveMouseDelay', args)404 def Set_Ocr_Text_Read(self, ocrTextRead):405 """406 OCR text read407 """408 args = [ocrTextRead]409 return self.lib.run_keyword('setOcrTextRead', args)410 def Set_Roi(self, coordinates, timeout=0):411 """412 Set ROI413 Set region of interest on screen414 Optionally pass highlight timeout.415 Examples:416 | Set ROI | [x, y, w, h] |417 | Set ROI | [x, y, w, h] | 2 |418 """419 args = [coordinates, timeout]420 return self.lib.run_keyword('setRoi', args)421 def Set_Show_Actions(self, showActions):422 """423 Set show actions424 """425 args = [showActions]426 return self.lib.run_keyword('setShowActions', args)427 def Set_Slow_Motion_Delay(self, delay):428 """429 Set slow motion delay430 Control the duration of the visual effect (seconds).431 """432 args = [delay]433 return self.lib.run_keyword('setSlowMotionDelay', args)434 def Set_Timeout_Using_Image(self, timeout):435 """436 Set timeout437 Set Sikuli timeout(seconds)438 Examples:439 | Set timeout | 10 |440 """441 args = [timeout]442 return self.lib.run_keyword('setTimeout', args)443 def Set_Wait_Scan_Rate(self, delay):444 """445 Set wait scan rate446 Specify the number of times actual search operations are performed per second while waiting447 for a pattern to appear or vanish.448 """449 args = [delay]450 return self.lib.run_keyword('setWaitScanRate', args)451 def Start_Sikuli_Process(self, port=None):452 """453 This keyword is used to start sikuli java process.454 If library is inited with mode OLD, sikuli java process is started automatically.455 If library is inited with mode NEW, this keyword should be used.456 :param port: port of sikuli java process, if value is None or 0, a random free port will be used457 :return: None458 """459 args = [port]460 return self.lib.run_keyword('start_sikuli_process', args)461 def Stop_Remote_Server(self):462 """463 Stops the remote server.464 The server may be configured so that users cannot stop it.465 """466 args = []467 return self.lib.run_keyword('stop_remote_server', args)468 def Type_With_Modifiers(self, text, *modifiers):469 """470 Type with modifiers471 Examples:472 |Type With Modifiers| A | CTRL |473 """474 args = [text, modifiers]475 return self.lib.run_keyword('typeWithModifiers', args)476 def Wait_For_Image(self, wantedImage, notWantedImage='', timeout=10):477 """478 Wait For Image479 Check wantedImage exist. If notWantedImage appear or timeout happened, throw exception480 @wantedImage: expected image in screen481 @notWantedImage: unexpected image in screen482 @timeout: wait seconds483 Examples:484 | Wait For Image | wanted.png | notWanted.png | 5 |485 """486 args = [wantedImage, notWantedImage, timeout]487 return self.lib.run_keyword('waitForImage', args)488 def Wait_For_Multiple_Images(self, timeout, pollingInterval, expectedImages, notExpectedImages):489 """490 Wait For Multiple Images491 Check if images exists in expectedImages or notExpectedImages list.492 If image appears that is listed in notExpectedImages list or timeout happened,493 throw exception If image appears that is listed in expectedImageslist return successfully.494 @timeout: wait seconds495 @pollingInterval: time in seconds between screen checks496 @expectedImages: list of expected images in screen497 @notExpectedImages: list of not expected images in screen498 Examples:499 | @{wanted_images} = | Create List | wanted_image1.png | wanted_image2.png |500 | @{not_wanted_images}= | Create List | not_wanted_image1.png | not_wanted_image2.png | not_wanted_image3.png |501 | Wait For Multiple Images | 900 | 10 | ${wanted_images} | ${not_wanted_images} |502 """503 args = [timeout, pollingInterval, expectedImages, notExpectedImages]504 return self.lib.run_keyword('waitForMultipleImages', args)505 def Wait_Until_Screen_Contain_Using_Image(self, image, timeout=10):506 """507 Wait until screen contain508 Wait until image shown in screen509 """510 args = [image, timeout]511 return self.lib.run_keyword('waitUntilScreenContain', args)512 def Wait_Until_Screen_Not_Contain_Using_Image(self, image, timeout=10):513 """514 Wait until screen not contain515 Wait until image not in screen516 """517 args = [image, timeout]518 return self.lib.run_keyword('waitUntilScreenNotContain', args)519 def Wheel_Down(self, steps, image=''):520 """521 Wheel down522 Move mouse to the target, and wheel down with give steps523 Examples:524 | Wheel Down | 5 |525 | Wheel Down | 5 | test.png |526 """527 args = [steps, image]528 return self.lib.run_keyword('wheelDown', args)529 def Wheel_Up(self, steps, image=''):530 """531 Wheel up532 Move mouse to the target, and wheel up with give steps533 Examples:534 | Wheel Up | 5 |535 | Wheel Up | 5 | test.png |536 """537 args = [steps, image]...

Full Screen

Full Screen

sikuliwrapper.py

Source:sikuliwrapper.py Github

copy

Full Screen

...105 self.sikuli.run_keyword("rightClickIn", arguments)106 def screen_should_contain(self, image_name):107 arguments = [image_name]108 return self.sikuli.run_keyword("screenShouldContain", arguments)109 def screen_should_not_contain(self, image_name):110 arguments = [image_name]111 return self.sikuli.run_keyword("screenShouldNotContain", arguments)112 def select_and_capture_region(self, message):113 arguments = [message]114 return self.sikuli.run_keyword("selectRegion", arguments)115 def set_capture_image_directory(self, path):116 arguments = [path]117 self.sikuli.run_keyword("setCaptureFolder", arguments)118 def set_move_mouse_delay(self, delay):119 arguments = [delay]120 self.sikuli.run_keyword("setMoveMouseDelay", arguments)121 def set_slow_motion_delay(self, delay):122 arguments = [delay]123 self.sikuli.run_keyword("setSlowMotionDelay", arguments)...

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 robotframework-androidlibrary 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