使用AutoIT.exe时,Selenium Webdriver脚本无法通过jenkins运行

使用AutoIT.exe时,Selenium Webdriver脚本无法通过jenkins运行,jenkins,autoit,Jenkins,Autoit,我有一个使用SeleniumWebDriver关键字构建的脚本。此脚本有一个autoIt.ext,用于文件上载的特定任务。它在Eclipse中工作得很好。然而,当我使用Jenkins计划它们时,这一步失败了 ControlFocus("Open", "", "Edit1") ControlSetText(“打开”、“编辑1”、“C:\XXX\XXX.jpg”) 控制单击(“打开”、“按钮1”) 我也面临同样的问题,但通过将.exe文件直接上传到git repo上解决了这个问题。 试试这个,也许

我有一个使用SeleniumWebDriver关键字构建的脚本。此脚本有一个autoIt.ext,用于文件上载的特定任务。它在Eclipse中工作得很好。然而,当我使用Jenkins计划它们时,这一步失败了

ControlFocus("Open", "", "Edit1")
ControlSetText(“打开”、“编辑1”、“C:\XXX\XXX.jpg”) 控制单击(“打开”、“按钮1”)


我也面临同样的问题,但通过将.exe文件直接上传到git repo上解决了这个问题。
试试这个,也许你会走运

下面是我如何修复它的。对于这个不太符合逻辑的问题,我在AutoIT代码中添加了“Sleep(2000)”,瞧,它成功了。ControlFocus(“打开”、“编辑1”)ControlSetText(“打开”、“编辑1”、“驱动器:\Location\file.extn”)Sleep(2000)ControlClick(“打开”、“编辑1”、“按钮1”)
    - The keyword:

public static void file_Upload(String vKeyword){

        new WebDriverWait(myDriver, 30).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@title='Choose a file to upload']")));
        myDriver.findElement(By.xpath("//input[@title='Choose a file to upload']")).click();
 Runtime.getRuntime().exec("C:\XXX\xxx.exe");
        }