【问题标题】:Test the position of the image in map using sikuli webdriver使用 sikuli webdriver 测试图像在地图中的位置
【发布时间】:2015-01-17 00:49:47
【问题描述】:

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

【问题讨论】:

  • 你能举个具体的例子吗? Wiki 上有一个using the SikuliFirefoxDriver with Google Maps 的示例。
  • 感谢 seumas 的回复。我看过那个例子。我的情况是,这是一张带有车辆(图像)的地图,我需要测试这些车辆是否位于地图上的正确位置。我试图获取图像的纬度和日志,但我仍然找不到合适的方法。

标签: java selenium-webdriver sikuli


【解决方案1】:

我认为您可能正在寻找这样的东西: 在 de sikuli 文档中,您可以找到一些关于如何获取位置的信息: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')

【讨论】:

    猜你喜欢
    • 2017-11-06
    • 1970-01-01
    • 2017-05-30
    • 1970-01-01
    • 2014-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多