如何使用java和selenium在remote中通过StringSelection;网格;?

如何使用java和selenium在remote中通过StringSelection;网格;?,java,selenium-grid,Java,Selenium Grid,我试图上传一个带有Robot类和selenium网格的文件 我可以在本地窗口中执行此操作,但当我尝试在远程计算机中上载时,我无法通过远程计算机中的StringSelection,StringSelection在本地已通过 这是我的密码 public static void adjFile1() throws AWTException { Robot rbt = new Robot(); StringSelection path = new StringSelec

我试图上传一个带有Robot类和selenium网格的文件

我可以在本地窗口中执行此操作,但当我尝试在远程计算机中上载时,我无法通过远程计算机中的StringSelection,
StringSelection
在本地已通过

这是我的密码

public static void adjFile1() throws AWTException {
        Robot rbt = new Robot();

        StringSelection path = new StringSelection(
                "C:\\Users\\tpereira\\eclipse_git\\BCN_WorkFlow_1\\src\\test\\resources\\Archivos\\Contrato 2 FCB.pdf");

        // create an object to desktop
        Toolkit.getDefaultToolkit().getSystemClipboard().setContents(path, null);

        rbt.delay(2000);
        // copy the path into mouse
        rbt.keyPress(KeyEvent.VK_ENTER);
        rbt.keyRelease(KeyEvent.VK_ENTER);
        rbt.keyPress(KeyEvent.VK_CONTROL);
        rbt.keyPress(KeyEvent.VK_V);
        rbt.keyRelease(KeyEvent.VK_V);
        rbt.keyRelease(KeyEvent.VK_CONTROL);
        rbt.keyPress(KeyEvent.VK_ENTER);
        rbt.keyRelease(KeyEvent.VK_ENTER);

@Then("^I attach the process documentation \"([^\"]*)\"$")
    public void adjuntoDocumentacionDelProceso(String expectedMessage) throws Throwable {

        JavascriptExecutor jse = (JavascriptExecutor) driver;
        rbt = new Robot();
        WebDriverWait wait = new WebDriverWait(driver, 10);
        WebElement upLoad = wait.until(ExpectedConditions.elementToBeClickable(By.xpath(adj_Doc)));
        jse.executeScript("arguments[0].scrollIntoView();", upLoad);
        upLoad.click();

        Functions_w_1.adjFile1();

        rbt.delay(1000);
        String message = driver.findElement(By.xpath(popUp_Error_Solic)).getText();
        System.out.println("Documento adjuntado correctamente: " + message.toString());
        Assert.assertTrue("No se ha adjuntado el archivo!!!", message.contains(expectedMessage));

    }

我可以使用此代码在虚拟机中使用Selenium网格远程附加该文件。 现在我只需要关闭单击打开的窗口

    public void adjuntoDocumentacionDelProceso(String expectedMessage) throws Throwable {

        JavascriptExecutor jse = (JavascriptExecutor) driver;
        rbt = new Robot();
        WebDriverWait wait = new WebDriverWait(driver, 10);
        WebElement upLoad = wait.until(ExpectedConditions.elementToBeClickable(By.xpath(adj_Doc)));
        jse.executeScript("arguments[0].scrollIntoView();", upLoad);
        upLoad.click();
        rbt.delay(800);

        driver.switchTo().activeElement().sendKeys("C:\\Users\\QABCN\\Documents\\contractos\\Contrato 1 FCB.pdf");
        //functionsEspai.adjFile1();

        rbt.delay(1000);
        String message = driver.findElement(By.xpath(popUp_Error_Solic)).getText();
        Assert.assertTrue("No se ha adjuntado el archivo!!!", message.contains(expectedMessage));

        System.out.println("Documento adjuntado correctamente: " + message.toString());

    }```