在debuging期间,该程序正常运行。但是当我运行该程序时出现此错误

时间:2016-02-22 06:33:38

标签: selenium selenium-webdriver

    public void VerfiyPcsAccount() throws Exception
        {
            String expectedId="111109531";
            BasePage Baseobj=new BasePage();
            Baseobj.LoginAdmin3();
            driver.switchTo().frame("bottom");
            try
            {
                Thread.sleep(50);
custinfoprimusclick(admin.getProperty("admin_custinfoprimuslink"));
            }catch(Exception e)
            {
                e.printStackTrace();
            }
            driver.switchTo().defaultContent();
            driver.switchTo().frame("bottom");
            driver.findElement(By.name("w_custno")).sendKeys("111109531");
            click(admin.getProperty("admin_findclick"));
            driver.switchTo().defaultContent();
            driver.switchTo().frame("bottom");
driver.findElement(By.xpath("//table[@id='globalnav']/tbody/tr[1]/td/a[5]")).click();
            String actualId=driver.findElement(By.xpath("//table[1]/tbody/tr/td/table/tbody/tr[2]/td[2]")).getText();
            Thread.sleep(3000);
            driver.findElement(By.linkText("Primus DHP Portal")).click();
            Thread.sleep(30000);

我调试应用程序它的执行正常。当我运行应用程序时,我得到错误::没有这样的元素   (会话信息:chrome = 48.0.2564.116)   (驱动程序信息:chromedriver = 2.7.236900,platform = Windows NT 6.1 SP1 x86)(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:30.13秒 有关此错误的文档,请访问:http://seleniumhq.org/exceptions/no_such_element.html 构建信息:版本:'2.49.0',修订版:'365eeb4',时间:'2016-01-13 18:33:29' 系统信息:主机:'GGNLAP-NSINGH',ip:'10 .10.251.198',os.name:'Windows 7',os.arch:'x86',os.version:'6.1',java.version:'1.7 .0_79' ***元素信息:{Using = xpath,value = // a [contains(text(),'Customer Info - Primus')]}

1 个答案:

答案 0 :(得分:0)

The problem is resolve i have increase the time for 2second.
Its working fine.
try
        {
            Thread.sleep(2000);
            custinfoprimusclick(admin.getProperty("admin_custinfoprimuslink"));
        }catch(Exception e)
        {
            e.printStackTrace();
        }
Thanks