Service Virtualization

Expand all | Collapse all

How to execute Selenium Webdriver scripts in ca dev test

  • 1.  How to execute Selenium Webdriver scripts in ca dev test

    Posted Jun 07, 2016 05:16 PM

    Selenium WebDriver integration with LISA

     

    I have a question raised at the above link.could you please provide a solution for the above one.

     

    Hello Arif,

     

    We have a very similar requirement in our account. Previously, we have developed a keyword driven framework in Selenium(Java) using TestNG framework. Recently our client has procured LISA license. Since this is a keyword driven framework, there is no script for each test case. Test cases and test steps are defined in Excel sheets. Each step in test case will call a Java function, which in turn will interact with web browser and perform the action.

     

    I have a question related Automation testing.

    We have a testing framework built in Selenium Webdriver(JAVA), now our company has decided to move to LISA.

    So can any one please help me to understand that how can I integrate or move my code to LISA (we have used JAVA to build framework, NOT used Selenium IDE).

    Thanks,

    Raghu



  • 2.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Broadcom Employee
    Posted Jun 07, 2016 10:17 PM

    Hi

     

    I think your question related to not Client Automation but DevTest. So, I moved this thread to DevTest community.

     

    Thanks

    Yas



  • 3.  Re: How to execute Selenium Webdriver scripts in ca dev test
    Best Answer

    Posted Jul 18, 2017 11:32 AM

    Hi,

        Convert your script into a jar file and deploy the jar file into hot deploy folder  and you can execute the jar file either from Execute External Command Step or Dynamic Java execution steps.

                                                        Thanks,

    Regards,

    Vish



  • 4.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Nov 10, 2017 05:39 AM

    Hi RaghuUppara

     

    did you got any solution for how to integrate you selenium script with LISA. Actually i wanted to run my selenium script on server headless. Can you please you help?



  • 5.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Nov 10, 2017 10:48 AM

    Hi,

         What do you mean by running the script headless on server,do you mean headless browser testing.If so,did you evaluate the risk associated with running your selenium scripts headless. If mean to run the test case by CA DevTest test runner you use the following link Test Runner - DevTest Solutions - 8.0.1 - CA Technologies Documentation 

    Thanks,

    Vish



  • 6.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Nov 14, 2017 09:56 AM

    Hi @LearnNow,

     

    yes i mean headless browser testing only, my requirement is to have the login functionally done through selenium and then store final URL after authentication and this URL is used to call api's.

    So I don't want when I deploy my test case on server, browser should get opened. Right now i am able to do on local by making a simple JSON step as first step(browser window opens) and then further(headless run)

    TestRun tr = testExec.getStateObject("selenium.testrun");
    RemoteWebDriver rwd = tr.driver();

     

    getting webdriver object and using to perform further actions.. Please can you help

     

    1. how to run this test case on server

    2. how could i do headless browser testing or my test case will run headless on server

     

    Note: Devtest version 9.1

    Thanks in Advance for help!!



  • 7.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Nov 14, 2017 12:35 PM

    Hi Suniti,

                   I never developed the script for headless browser testing in LISA directly but what I did was

    1)Developed the selenium script using  "HtmlUnitDriver" in eclipse and then made a runnable jar out of the code and then deployed jar in hotDeploy folder and  called the jar file in LISA using Dynamic java execution step.

    2)To run  the test case,I deployed the test case as a MAR file  in to CVS  and scheduled the test case as per my requirement.



  • 8.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Nov 16, 2017 09:08 AM

    Hi LearnNow /Vish

     

    May be i sound foolish, but can you please let me know where you placed your htmlunitdriver.exe/ any broswer related exe. I placed it on hotdeploy @local and its working fine for me. So when we make the Jars out of our code then i also need to place my driver.exe @server hotdeploy folder correct?

    Thanks for answering all my questions



  • 9.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Nov 16, 2017 10:40 AM

    Hi Suniti,

                   Generally when you try to run any jar files in CA DevTest it basically searches for the dependencies in CA DevTest installation folder hot deploy or lib  folders if you have not mentioned any folder name in your framework.For your case " driver.exe @server hotdeploy folder " will work.Any other  suggestions of doing this are welcome.

     



  • 10.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Nov 17, 2017 07:45 AM

    Hi LearnNow

     

    I asked above question because on server I am not able to run my test, though I had specifically given path of chromedriver that is not saved in hotdeploy or lib as I don't have access rights.

    Iam getting below error

     

    Do you please know what I am missing?Thanks so much for such a proactive response

     

    | Error executing Selenium Step :
    [{"negated":false,"type":"get","url":"https://www.google.com/"}]

    ============================================================================

    | Step:        Get

    ----------------------------------------------------------------------------

    | Message:     Test run failed: unable to create driver.

    ----------------------------------------------------------------------------

    | Trapped Exception: Test run failed: unable to create driver.

    | Trapped Message:   java.lang.RuntimeException: Test run failed: unable to create driver.

    ----------------------------------------------------------------------------

    STACK TRACE

    java.lang.RuntimeException: Test run failed: unable to create driver.

     at com.sebuilder.interpreter.TestRun.initRemoteWebDriver(TestRun.java:215)

     at com.itko.lisa.glass.SeleniumScriptExecutor.executeStep(SeleniumScriptExecutor.java:370)

     at com.itko.lisa.glass.SeleniumScriptExecutor.executeStep(SeleniumScriptExecutor.java:305)

     at com.itko.lisa.glass.SeleniumStep.execute(SeleniumStep.java:313)

     at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)

     at com.itko.lisa.test.TestCase.execute(TestCase.java:1295)

     at com.itko.lisa.test.TestCase.execute(TestCase.java:1210)

     at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1195)

     at com.itko.lisa.test.TestCase.executeTest(TestCase.java:1136)

     at com.itko.lisa.coordinator.Instance.run(Instance.java:204)

    Caused by: java.lang.reflect.InvocationTargetException

     at sun.reflect.GeneratedConstructorAccessor105.newInstance(Unknown Source)

     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

     at java.lang.reflect.Constructor.newInstance(Unknown Source)

     at com.sebuilder.interpreter.TestRun.initRemoteWebDriver(TestRun.java:201)

     ... 9 more

    Caused by: org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
      (Driver info: chromedriver=2.24.417431 (9aea000394714d2fbb20850021f6204f2256b9cf),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 1.06 seconds
    Build info: version: '2.48.2', revision: , time: '2015-10-09 13:08:06'
    System info: host: 'sd-b6fd-adfc', ip: , os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_60'
    Driver info: org.openqa.selenium.chrome.ChromeDriver

     at sun.reflect.GeneratedConstructorAccessor107.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:647)

     at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)

     at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)

     at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)

     at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)

     at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:138)

     ... 13 more

    ============================================================================



  • 11.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Nov 17, 2017 10:20 AM

    Hi, 

        The error is saying the script is looking for the chromedriver.exe on the server.You need to place the chromedriver.exe in the hotDeploy folder  on server.

    Thanks,

    Vish



  • 12.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Jan 31, 2018 07:19 AM

    Hi LearnNow

     

    Thanks for replying in Advance!!

    Your suggestions has helped me a lot...

    I wrote code in eclipse using selenium webdriver and set the path as mentioned below

    System.setProperty("webdriver.chrome.driver","<ServerPath>\\chromedriver.exe");

    then made executable jar and ran the code using execute external command step from LISA.. from local its working fine but when i placed my code on server (.tst) then it says 

    Caused by: org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
    (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 687 milliseconds
    Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
    System info: host: 'SD-8035-16E0', ip: '168.72.199.135', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_77'
    Driver info: driver.version: ChromeDriver

     

    I know I haven't placed chrome.exe in hotdeploy folder but is that some other way...my exe is present at the location where I had set my system property and in config file also I had set the path as

     

    selenium.browser.type=Chrome
    selenium.chrome.driver.path=<server path same as above>/chromedriver.exe

     

    Do you know any workaround, if i dont place exe @hotdeploy?

     

    Thanks Vish 

     



  • 13.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Jan 31, 2018 10:36 AM

    Hi,

         There are few ways or steps in CA DevTest through which we can a Selenium script.

    1)Using CA DevTest inbuilt Selenium Integrator step

    2)Write your own selenium script in an IDE(Eclipse) in using the programming language(Java) of your choice and make an executable of the script(i.e runnable jar) and place/deploy the executable in any accessible folder location and call the executable using CA DevTest Execute External Command Step 

               From the comments, I think you are getting mixed up with other ways of doing it. My suggestion would be stick to one way of achieving this.

                                                Thanks,

    Regards,

    Vish



  • 14.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Feb 05, 2018 05:00 AM

    hi @LearNow,

     

    I am not getting confused with different ways,

    )Write your own selenium script in an IDE(Eclipse) in using the programming language(Java) of your choice and make an executable of the script(i.e runnable jar) and place/deploy the executable in any accessible folder location and call the executable using CA DevTest Execute External Command Step 

     

    >> Did by the above way only but still getting error on server not on local... My jar and my Execute External command step is running fine via ITR.

     

    Error

    Caused by: org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
    (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 687 milliseconds
    Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
    System info: host: 'SD-8035-16E0', ip: '168.72.199.135', os.name: 'Windows Server 2012 R2', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_77'
    Driver info: driver.version: ChromeDriver



  • 15.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Feb 05, 2018 07:45 AM

    Hi Suniti,

     

    The path to chrome browser executable (chrome.exe) is not included in the PATH environment variable. Please add the full path and it should work.

     

    Sent from my phone, please excuse the brevity or misspellings - Shrikara



  • 16.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Feb 05, 2018 10:39 AM

    Hi,

        "Did by the above way only but still getting error on server not on local... My jar and my Execute External command step is running fine via ITR.".Since the binaries and dependencies are not deployed on the server you are getting above error.What is server version?

                                                                         Thanks,

    Vish 



  • 17.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Feb 12, 2018 04:43 AM

    Hi @LearnNow,

     

    Sorry for delayed response

    Iam using Devtest9.1...

    Since the binaries and dependencies are not deployed on the server you are getting above error... Please can you put some more light on which all binaries I need to deploy.

     

     

    As usual Thanks in Advance!!:):)



  • 18.  Re: How to execute Selenium Webdriver scripts in ca dev test

    Posted Feb 12, 2018 10:24 AM

    Hi,

        In this case, Selenium jar files and Chrome/IE/Firefox drivers are dependencies.What server is being used?

    Note: Avoid duplication of these jar files, since DevTest by default provides them.Use appropriate version according to your need.

                                                        Thanks,

    Vish