NgWebDriver

177 views
Skip to first unread message

Balaji Singh .Y

unread,
Sep 20, 2016, 8:47:02 AM9/20/16
to seleniu...@googlegroups.com
Hi All,

As my site is developed using Angular Js and i need to get it automated so thought of using NgWebDriver as a choice and also to give an try once.
So i have written  a small piece of code  below to test  one particular functionality but then when i run it opens the browser even hooks on with url.

The real issue is while interacting with model webelement it throws error like "org.openqa.selenium.WebDriverException: ha.element(...).injector(...) is undefined".

Can somebody shed some light on this issue and provide an solution. And plz let me know where i am going wrong. 

Selenium version that iam using is : 2.53.1


public class Example1{

     public  FirefoxDriver driver;
     public  NgWebDriver ngWebDriver;

 @BeforeSuite
    public void before_suite() throws Exception {
         driver = new FirefoxDriver();
         driver.manage().timeouts().setScriptTimeout(30, TimeUnit.SECONDS);
        ngWebDriver = new NgWebDriver(driver);

    }

      public void find_by_angular_model() throws Exception
       {

            driver.get("url");
 
            ngWebDriver.waitForAngularRequestsToFinish();

            Thread.sleep(2000);  //just used wait for time being.

            WebElement firstname = driver.findElement(ByAngular.buttonText("Create New SLI"));
             firstname.click();
            Thread.sleep(3000);        
        
           driver.findElement(ByAngular.model("SLI.prefFlightNumber1")).sendKeys("1111");
            Thread.sleep(2000);  
     }
}


Console Output
===========
FAILED: find_by_angular_model
org.openqa.selenium.WebDriverException: ha.element(...).injector(...) is undefined
Command duration or timeout: 20 milliseconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'PDCHP64-VM10085', ip: '10.27.23.235', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=47.0.1, platform=WINDOWS, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: f498255c-969a-482a-88eb-9b7188df6541
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:577)
at com.paulhammant.ngwebdriver.ByAngularModel.getObject(ByAngularModel.java:16)
at com.paulhammant.ngwebdriver.ByAngular$BaseBy.findElement(ByAngular.java:170)
at com.paulhammant.ngwebdriver.ByAngularModel.findElement(ByAngularModel.java:6)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
at com.paulhammant.ngwebdriver.AngularAndWebDriverTest.find_by_angular_model(AngularAndWebDriverTest.java:92)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1191)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
at org.testng.TestNG.run(TestNG.java:1024)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:152)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57)
Caused by: org.openqa.selenium.WebDriverException: ha.element(...).injector(...) is undefined
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'PDCHP64-VM10085', ip: '10.27.23.235', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: unknown
at <anonymous class>.Id(http://xltcartca03:13150/cargosliux/modules/js/angular.js?verLbl=1.350:18)
at <anonymous class>.anonymous(http://xltcartca03:13150/cargosliux/modules/#/home line 69 > Function:10)
at <anonymous class>.handleEvaluateEvent(http://xltcartca03:13150/cargosliux/modules/#/home:69)

--
BALAJI SINGH .Y
Reply all
Reply to author
Forward
0 new messages