【问题标题】:set proxy for firefox using sikuli in java在java中使用sikuli为firefox设置代理
【发布时间】:2019-05-11 11:21:28
【问题描述】:

我是sikuli 的新手,我想使用 sikuli 运行 firefox 并在其上设置代理(通过 foxyproxy)。此代码打开 Firefox 并加载“https://google.com”。如何点击 Firefox 工具栏中的 foxyproxy 按钮并使用 sikuli 创建新代理?

import org.sikuli.script.*;


public class SikulixTest {

    public static void main(String[] args) {

        Screen s = new Screen();
        App browser = App.open("Firefox");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {

            e.printStackTrace();
        }
        browser.focus();
        s.highlight(0);
        s.type("https://google.com" + Key.ENTER);
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {

            e.printStackTrace();
        }

        browser.close();
    }

}

谢谢,

【问题讨论】:

    标签: java sikuli browser-automation sikuli-script sikuli-x


    【解决方案1】:

    Sikuli 基于视觉模式匹配工作。为了做你需要的,你必须:

    1. 用您想要与之交互的屏幕区域截取屏幕截图(在您的情况下是 FF 中的 FoxyProxy 图标)
    2. 定义Pattern类型的对象
    3. 使用步骤中定义的对象来查找屏幕上的图案
    Pattern pattern = new Pattern("screenshot.png");
    Match m = s.find(pattern);
    m.click();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-29
      • 2017-04-19
      • 1970-01-01
      • 2018-02-07
      • 1970-01-01
      • 2019-11-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多