0

我的项目是自动化 IHM。错误场景:

  1. 点击链接
  2. 将出现一个弹出窗口,单击“选择文件...”按钮。
  3. Windows框架(windows 10)打开本地选择文件,点击“打开”,问题是鼠标无法点击“选择文件...”按钮。

代码:

   public void leFichierDImportEstChoisi() throws Throwable {
        RadioGroup fileSource = browser.describe(RadioGroup.class, new RadioGroupDescription.Builder()
                .name("fileLocation")
                .tagName("INPUT").build());

        fileSource.select("1");

        WebElement fileFieldText = browser.describe(WebElement.class, new WebElementDescription.Builder()
                .innerText("Select File...")
                .tagName("SPAN").build());

        FileField fileField = browser.describe(FileField.class, new FileFieldDescription.Builder()
                .name("file")
                .tagName("INPUT").build());

    
        Mouse.click(fileFieldText.getLocation());
        fileField.setValue(importFilePath + importFileName);

        Button uploadButton = browser.describe(Button.class, new ButtonDescription.Builder()
                .buttonType("button")
                .name("Upload")
                .tagName("BUTTON").build());

        uploadButton.click();
    }

错误 :

com.hp.lft.sdk.ReplayObjectNotFoundException: Exception de HRESULT : 0x80040202
    at com.hp.lft.sdk.internal.ReplayExceptionFactory$1.create(ReplayExceptionFactory.java:35)
    at com.hp.lft.sdk.internal.ReplayExceptionFactory.createOrDefault(ReplayExceptionFactory.java:289)
    at com.hp.lft.sdk.internal.ReplayExceptionFactory.createOrDefault(ReplayExceptionFactory.java:22)
    at com.hp.lft.sdk.internal.TestObjectExecuterBehaviorBase$ReplayErrorHandler.onError(TestObjectExecuterBehaviorBase.java:65)
    at com.hp.lft.sdk.internal.CommunicationClientImpl.handleError(CommunicationClientImpl.java:221)
    at com.hp.lft.sdk.internal.CommunicationClientImpl.send(CommunicationClientImpl.java:96)
    at com.hp.lft.sdk.internal.TestObjectExecuterBehavior.executeMethod(TestObjectExecuter.java:33)
    at com.hp.lft.sdk.internal.TestObjectBase.executeMethod(TestObjectBase.java:124)
    at com.hp.lft.sdk.internal.web.WebEditFieldBase.access$000(WebEditFieldBase.java:8)
    at com.hp.lft.sdk.internal.web.WebEditFieldBase$1.invoke(WebEditFieldBase.java:20)
    at com.hp.lft.sdk.internal.TestObjectOperationWrapper.executeWithEvents(TestObjectOperationWrapper.java:81)
    at com.hp.lft.sdk.internal.TestObjectOperationWrapper.executeWithEvents(TestObjectOperationWrapper.java:102)
    at com.hp.lft.sdk.internal.web.WebEditFieldBase.setValue(WebEditFieldBase.java:24)
    at Tests.DMTImport.leFichierDImportEstChoisi(DMTImport.java:222)
    at ✽.When le fichier d'import est choisi(DMTImport.feature:17)

at Tests.DMTImport.leFichierDImportEstChoisi(DMTImport.java:222) is :  fileField.setValue(importFilePath + importFileName);

提前感谢您的帮助

4

0 回答 0