【问题标题】:The program is running fine during the debuging. But when i am running the program getting this error程序在调试过程中运行良好。但是当我运行程序时出现此错误
【发布时间】:2016-06-03 11:55:44
【问题描述】:
    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);

我已经调试了应用程序,它的执行很好。当我运行应用程序时,我得到了错误:: no such element (会话信息: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')]}

【问题讨论】:

  • 使用等待功能而不是休眠。

标签: selenium selenium-webdriver


【解决方案1】:
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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-25
    • 2015-06-28
    • 1970-01-01
    • 1970-01-01
    • 2012-11-05
    • 2016-01-02
    相关资源
    最近更新 更多