简体   繁体   中英

Test the position of the image in map using sikuli webdriver

I'm not sure it is something possible to do with sikuli webdriver. I have searched over the internet but couldn't find any article about this matter. What I want to do is to get the latitude and longitude of the given image in the map for testing purpose. Is that something possible to do with sikuli web driver. If not is there any other solution to test maps ? Any hint or link for a tutorial would be appreciated.

I think you might be looking for something like this: In de sikuli doc you can find a bit of info on how to grab location: doc.sikuli on Location

Example code: (Sikuli with Python)

class Cords():
     def __init__(self):
          # Find the image
          imageLoc = find("image1.png")
          # Get the X, Y position
          x = imageLoc.getX() # For example: x = 499
          y = imageLoc.getY() # For example: y = 811
          # Print the positions
          print(x, y)
          # Look if the image is on this given position. 
          if (imageLoc.getX() == 499) and (imageLoc.getY() == 811):
               print('Correct')
          else:
               print('Incorrect')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM