Java 当我试图运行代码时,会出现一条错误消息

Java 当我试图运行代码时,会出现一条错误消息,java,selenium,Java,Selenium,当我试图运行下面提到的代码时,会出现一条错误消息。在我的代码中,我试图执行注销函数。对于这个注销函数,我准备了一个excel,其中正确存储了注销xpath。但当我试图执行此代码时,会出现一条错误消息。错误消息是元素在点(1155,20)处不可单击。其他元素将收到单击 package com.rmspl.multiplemethod; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.o

当我试图运行下面提到的代码时,会出现一条错误消息。在我的代码中,我试图执行注销函数。对于这个注销函数,我准备了一个excel,其中正确存储了注销xpath。但当我试图执行此代码时,会出现一条错误消息。错误消息是元素在点(1155,20)处不可单击。其他元素将收到单击

package com.rmspl.multiplemethod;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.Select;

public class MethodSet {
static WebElement element;

public void login (String username,String password,String nr,WebDriver fd) {

     fd.get("http://117.247.65.9/vms_test");
     fd.manage().window().maximize();

    WebElement E1 = fd.findElement(By.name("j_username"));
    E1.sendKeys(username);

    WebElement E2 = fd.findElement(By.name("j_password"));
    E2.sendKeys(password);

    WebElement E3 = fd.findElement(By.name("log"));
    E3.click();

    }

        public void clickLink(String xPath,String nr,String nr1,WebDriver fd){
        element = fd.findElement(By.xpath(xPath));
        element.click();
        }
        public void Select(String xPath,String val,String nr1,WebDriver fd){
        Select sel = new Select(fd.findElement(By.xpath(xPath)));
        sel.selectByValue(val);
  }
}

package com.rmspl.multiplemethod;

import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;


public class TestDriver {

    static WebElement element;
    public static void main(String[] args) throws BiffException, IOException, NoSuchMethodException, SecurityException, 
    IllegalAccessException,IllegalArgumentException, InvocationTargetException {

    MethodSet mt = new MethodSet();

    System.setProperty("webdriver.chrome.driver","C:\\Users\\Arijit Mohanty\\Desktop\\chromedriver.exe");
    WebDriver fd = new ChromeDriver();

    FileInputStream fis = new FileInputStream("C:\\Users\\Arijit Mohanty\\Desktop\\Bangla\\HybridDatasheet.xls");
    Workbook WB = Workbook.getWorkbook(fis);
    Sheet Sh = WB.getSheet("Sheet2");

    int rows = Sh.getRows();
    int cols = Sh.getColumns();

    for (int i = 1; i<rows; i++)
        {
        String methodname = Sh.getCell(0, i).getContents();
        String data1 = Sh.getCell(1, i).getContents();
        String data2 = Sh.getCell(2, i).getContents();
        String data3 = Sh.getCell(3, i).getContents();

        Method m1 =  mt.getClass().getMethod(methodname, String.class,String.class,String.class, WebDriver.class);
        m1.invoke(mt,data1,data2,data3,fd);
        }


    }

}
package com.rmspl.multiplemethod;
导入org.openqa.selenium.By;
导入org.openqa.selenium.WebDriver;
导入org.openqa.selenium.WebElement;
导入org.openqa.selenium.support.ui.Select;
公共类方法集{
静态web元素;
公共无效登录(字符串用户名、字符串密码、字符串编号、WebDriver fd){
fd.get(“http://117.247.65.9/vms_test");
fd.manage().window().maximize();
WebElement E1=fd.findElement(By.name(“j_用户名”);
E1.发送密钥(用户名);
WebElement E2=fd.findElement(By.name(“j_密码”);
E2.发送密钥(密码);
WebElement E3=fd.findElement(By.name(“log”);
E3.单击();
}
公共无效点击链接(字符串xPath、字符串nr、字符串nr1、WebDriver fd){
element=fd.findElement(By.xpath(xpath));
元素。单击();
}
公共无效选择(字符串xPath、字符串val、字符串nr1、WebDriver fd){
Select sel=newselect(fd.findElement(By.xpath(xpath));
选择值(val);
}
}
包com.rmspl.multiplemethod;
导入java.io.FileInputStream;
导入java.io.IOException;
导入java.lang.reflect.InvocationTargetException;
导入java.lang.reflect.Method;
进口jxl.Sheet;
导入jxl.工作簿;
导入jxl.read.biff.BiffException;
导入org.openqa.selenium.WebDriver;
导入org.openqa.selenium.WebElement;
导入org.openqa.selenium.chrome.ChromeDriver;
公共类测试驱动程序{
静态web元素;
publicstaticvoidmain(字符串[]args)抛出biffeException、IOException、NoSuchMethodException、SecurityException、,
IllegalAccessException、IllegalArgumentException、InvocationTargetException{
MethodSet mt=新的MethodSet();
System.setProperty(“webdriver.chrome.driver”,“C:\\Users\\Arijit Mohanty\\Desktop\\chromedriver.exe”);
WebDriver fd=新的ChromeDriver();
FileInputStream fis=新的FileInputStream(“C:\\Users\\Arijit Mohanty\\Desktop\\Bangla\\HybridDatasheet.xls”);
工作簿WB=工作簿.get工作簿(fis);
表Sh=WB.getSheet(“表2”);
int rows=Sh.getRows();
int cols=Sh.getColumns();

对于(int i=1;i您需要等待加载_bg,直到屏幕关闭。请更新方法,单击下面给出的链接。请尝试并告知我们

public void clickLink(String xPath,String nr,String nr1,WebDriver fd){
   new WebDriverWait(fd, 90).until(ExpectedConditions.invisibilityOfElementLocated(By.id("loading_bg")));
   element = fd.findElement(By.xpath(xPath));
   element.click();

}

在您的代码中,哪一行抛出此消息?我们可以获得站点的URL吗?当我尝试单击注销函数时,会出现错误消息。注销函数xpath写在excel工作表中。站点URL-117.247.65.9/vms_test。用户名msrtc,密码Admin。共享excel数据-方法名ClickLink,Data1-//a[包含(text(),'Logout')],不需要数据2,不需要数据3。看起来注销按钮的xpath可能是正确的,但还有一些其他元素(类似于通知/弹出窗口)正在覆盖注销按钮。如果您提供URL@SantoshKumar,我已经分享了这个url。它是在登录之后出现的。请给出你有价值的建议。你能给我们用户名和密码吗。我会登录并检查logout@ThanksMurti.你的代码工作正常。非常感谢。非常感谢。问你需要知道什么是加载背景。此加载背景显示在错误消息中。如果可能,请回答。它是加载背景的id,用于阻止UI,直到后台进程完成。你需要等待。某些应用程序,它将加载条/符号。我不知道你的应用程序。谢谢@Murthi for您出色的解释和帮助。这意味着很多。再次感谢。现在这段代码工作正常。