使用sikuli webdriver测试图像在地图中的位置

时间:2015-01-07 02:33:27

标签: java selenium-webdriver sikuli

我不确定是否可以使用sikuli webdriver。我在互联网上搜索过但无法找到有关此事的任何文章。我想要做的是在地图中获取给定图像的纬度和经度以进行测试。这是与sikuli网络驱动程序有关的事情吗?如果没有,还有其他测试地图的解决方案吗? 任何教程的提示或链接都将不胜感激。

1 个答案:

答案 0 :(得分:0)

我想你可能正在寻找这样的东西: 在de sikuli doc中,您可以找到有关如何获取位置的一些信息:doc.sikuli on Location

示例代码: (Sikuli和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')