I am using sikuli-script.jar to click on images link with Selenium WebDriver (With TestNG framework). The same is working fine when i run my code Run as TestNGSuite or with ant run (from the command prompt).
Below is my code:-
WebDriver driver=new FirefoxDriver();
driver.get("http://google.com");
driver.manage().window().setSize(new Dimension(1366, 768));
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
System.out.println("Title is " +driver.getTitle());
System.out.println("Browser opened");
try {
Screen s=new Screen();
Pattern image=new Pattern("D:\\LoyalityFiles\\gmail\\1476714460371.png");
s.find(image);
s.click(image);
System.out.println("clicked on gmail");
System.out.println("Title of this page is " +driver.getTitle()+" and url is " +driver.getCurrentUrl());
driver.quit();
} catch (Exception e) {
e.printStackTrace();
}
}
issue:- While running this code via jenkins it throws :-
FindFailed: can not find P(D:\LoyalityFiles\gmail\1476714460371.png) S: 0.7 on the screen.
[testng] Line 1574, in file Region.java
[testng]
[testng] at org.sikuli.script.Region.handleFindFailed(Region.java:1574)
[testng] at org.sikuli.script.Region.wait(Region.java:1682)
[testng] at org.sikuli.script.Region.find(Region.java:1590)
[testng] at sikuli.ImageC.Google(ImageC.java:33)
[testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[testng] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[testng] at java.lang.reflect.Method.invoke(Method.java:606)
[testng] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
[testng] at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
[testng] at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
[testng] at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
[testng] at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
[testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
[testng] at org.testng.TestRunner.privateRun(TestRunner.java:774)
[testng] at org.testng.TestRunner.run(TestRunner.java:624)
[testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
[testng] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
[testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
[testng] at org.testng.SuiteRunner.run(SuiteRunner.java:261)
[testng] at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
[testng] at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
[testng] at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
[testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
[testng] at org.testng.TestNG.run(TestNG.java:1048)
[testng] at org.testng.TestNG.privateMain(TestNG.java:1355)
[testng] at org.testng.TestNG.main(TestNG.java:1324)
please note:- i am running jenkins as windows service. pls suggest!!
SikuliX cannot find your pattern on the Screen during 3 seconds (default value, Settings.AutoWaitTimeout) and throws FindFailed exception. Try to raise Settings.AutoWaitTimeout or implement own smart waiter instead of screen.find()
Related
when I execute behat command on execute shell on jenkins, it gives me following error.
**
"BUILD FAILED
/var/lib/jenkins/workspace/behat/behatTest/build.xml:5: Execute failed: java.io.IOException: Cannot run program "behat": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:58)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:629)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:670)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:496)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:293)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1405)
at org.apache.tools.ant.Project.executeTarget(Project.java:1376)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1260)
at org.apache.tools.ant.Main.runBuild(Main.java:853)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:285)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:112)
Caused by: java.io.IOException: error=2, No such file or directory
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
at java.lang.ProcessImpl.start(ProcessImpl.java:134)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
... 24 more"
**
I can easily run behat command from command line on amazon ec2 server.
Are you calling behat command from Ant?
Try to use absolute behat path in your ant script.
It would be helpful if you would also post your Ant script.
Here's the sonar-runner.properties file in the project's root directory.
sonar.projectKey=baedalpos
sonar.projectName=baedal
sonar.projectVersion=1.0
sonar.scm.provider=svn
sonar.language=delph
sonar.dynamicAnalysis=false
sonar.sourceEncoding=UTF-8
sonar.sources=/home/svntest/30.1.Client/.
As you can see above, the project is written in Delphi, so I already downloaded and installed the Delphi plugin. When I run the sonar-runner command, it ends up leaving the following error message.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 10.024s
Final Memory: 55M/807M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalArgumentException: 737 is not a valid line for pointer. File [moduleKey=baedalpos, relative=Basic/uStoreTable.pas, basedir=/home/svntest/30.1.Client TEST] has 525 line(s)
at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:148)
at org.sonar.api.batch.fs.internal.DefaultInputFile.checkValid(DefaultInputFile.java:215)
at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:209)
at org.sonar.api.batch.fs.internal.DefaultInputFile.selectLine(DefaultInputFile.java:246)
at org.sonar.batch.issue.DeprecatedIssueBuilderWrapper.line(DeprecatedIssueBuilderWrapper.java:59)
at org.sonar.plugins.delphi.metrics.DeadCodeMetrics.save(DeadCodeMetrics.java:168)
at org.sonar.plugins.delphi.DelphiSensor.processFiles(DelphiSensor.java:134)
at org.sonar.plugins.delphi.DelphiSensor.analyse(DelphiSensor.java:112)
at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
"java.lang.IllegalStateException: The driver is not executable" error is coming when TestNG test cases run on Jenkins install on ubuntu 14.1. As if Chromedriver is not starting on jenkin installed on ubuntu, Same configuration tried on jenkin install on Window os, works fine.Please provide me any solution if any.
Console Ouput :
run:
[testng] org.testng.TestNGException:
[testng] Cannot instantiate class TestCase.NewsArticles_Section_TC
[testng] at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:38)
[testng] at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:387)
[testng] at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:299)
[testng] at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:110)
[testng] at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:186)
[testng] at org.testng.internal.TestNGClassFinder.<init>(TestNGClassFinder.java:120)
[testng] at org.testng.TestRunner.initMethods(TestRunner.java:409)
[testng] at org.testng.TestRunner.init(TestRunner.java:235)
[testng] at org.testng.TestRunner.init(TestRunner.java:205)
[testng] at org.testng.TestRunner.<init>(TestRunner.java:153)
[testng] at org.testng.SuiteRunner$DefaultTestRunnerFactory.newTestRunner(SuiteRunner.java:522)
[testng] at org.testng.SuiteRunner.init(SuiteRunner.java:157)
[testng] at org.testng.SuiteRunner.<init>(SuiteRunner.java:111)
[testng] at org.testng.TestNG.createSuiteRunner(TestNG.java:1299)
[testng] at org.testng.TestNG.createSuiteRunners(TestNG.java:1286)
[testng] at org.testng.TestNG.createSuiteRunners(TestNG.java:1289)
[testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
[testng] at org.testng.TestNG.run(TestNG.java:1057)
[testng] at org.testng.TestNG.privateMain(TestNG.java:1364)
[testng] at org.testng.TestNG.main(TestNG.java:1333)
[testng] Caused by: java.lang.reflect.InvocationTargetException
[testng] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[testng] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
[testng] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[testng] at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
[testng] at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:29)
[testng] ... 19 more
[testng] Caused by: java.lang.ExceptionInInitializerError
[testng] at pagefactory.NewsArticle_Section.NewsArticle_Section_Add.<init>(NewsArticle_Section_Add.java:18)
[testng] at TestCase.NewsArticles_Section_TC.<init>(NewsArticles_Section_TC.java:14)
[testng] ... 24 more
[testng] Caused by: java.lang.IllegalStateException: The driver is not executable: /var/lib/jenkins/jobs/Mentis kitchen test/workspace/lib/chromedriver.exe
[testng] at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
[testng] at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:126)
[testng] at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:117)
[testng] at org.openqa.selenium.chrome.ChromeDriverService.access$0(ChromeDriverService.java:1)
[testng] at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:118)
[testng] at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:291)
[testng] at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:82)
[testng] at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:117)
[testng] at reusablescript.driver.<clinit>(driver.java:12)
[testng] ... 26 more
[testng] The tests failed.
makexsltreports:
Looks like you are trying to run chromedriver.exe on Linux. You have to download binary file for Linux. .exe from stack trace doesn't look like correct one.
Then you have to add executable flag to it chmod +x chromedriver
Given below permission to chromedriver and it works.
chmod 777 chromedriver
As previous answer there is no relevance to the .exe part in stack trace
I'm running Selenium tests using a testNG framework, and an ANT task. The tests run fine on my windows machine..I then deployed it to my Jenkins CI server, and making necessary configurations for running the tests headless:
installed vnc-server on my server running jenkins (CentOS)
installed the Xvnc plugin for jenkins and enabled 'run Xvnc during build' in my job config
However I get the below error - any help? I have scoured the web but am unable to find a solution to: "org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console "
[workspace] $ /root/.jenkins/tools/hudson.tasks.Ant_AntInstallation/Ant/bin/ant
Buildfile: /root/.jenkins/jobs/automationFramework/workspace/build.xml
compile:
[javac] /root/.jenkins/jobs/automationFramework/workspace/build.xml:28: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 2 source files to /root/.jenkins/jobs/automationFramework/workspace/test-output
test:
[testng] [TestNG] Running:
[testng] /root/.jenkins/jobs/automationFramework/workspace/src/automationFramework/testng.xml
[testng]
[testng] org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
[testng] *** EM_LOG *** Item Installed via directory addition to Install Location: app-global Item ID: {972ce4c6-7e08-4474-a285-3208198ce6fd}, attempting to register...
[testng] *** EM_LOG *** Item Installed/Upgraded at Install Location: app-global Item ID: {972ce4c6-7e08-4474-a285-3208198ce6fd}, attempting to register...
[testng] *** Blocklist::_loadBlocklistFromFile: blocklist is disabled
[testng] *** EM_LOG *** ... success, item is compatible
[testng] *** EM_LOG *** Item Installed via directory addition to Install Location: app-profile Item ID: fxdriver#googlecode.com, attempting to register...
[testng] *** EM_LOG *** Item Installed/Upgraded at Install Location: app-profile Item ID: fxdriver#googlecode.com, attempting to register...
[testng] *** EM_LOG *** ... success, item is compatible
[testng] *** EM_LOG *** Item Installed via directory addition to Install Location: app-system-user Item ID: langpack-en-GB#firefox.mozilla.org, attempting to register...
[testng] *** EM_LOG *** Item Installed/Upgraded at Install Location: app-system-user Item ID: langpack-en-GB#firefox.mozilla.org, attempting to register...
[testng] *** EM_LOG *** ... success, item is compatible
[testng]
[testng] at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:118)
[testng] at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:246)
[testng] at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:114)
[testng] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:193)
[testng] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
[testng] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
[testng] at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:95)
[testng] at automationFramework.GoogleTest.testGoogle(Unknown Source)
[testng] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[testng] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[testng] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[testng] at java.lang.reflect.Method.invoke(Method.java:606)
[testng] at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
[testng] at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
[testng] at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
[testng] at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
[testng] at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
[testng] at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
[testng] at org.testng.TestRunner.privateRun(TestRunner.java:767)
[testng] at org.testng.TestRunner.run(TestRunner.java:617)
[testng] at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
[testng] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
[testng] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
[testng] at org.testng.SuiteRunner.run(SuiteRunner.java:240)
[testng] at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
[testng] at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
[testng] at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
[testng] at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
[testng] at org.testng.TestNG.run(TestNG.java:1057)
[testng] at org.testng.TestNG.privateMain(TestNG.java:1364)
[testng] at org.testng.TestNG.main(TestNG.java:1333)
selenium version-2.43
firefox - 3.6
Jenkins on centOS - 5.5
Thanks
it usually happens due to incompatible FF and WD versions. So, it makes sense to double check if versions you use are correct.
I have a cluster of VM's (all Windows 7) that I am trying to use to run some continuous integration from Jenkins. The tests are written in Java and from my local environment (windows 7) I can remotely connect to a VM and run my tests without any problems.
When I schedule the tests to run in Jenkins, I use the same command line arguments but during execution I get:
...
start-server:
doTest:
[testng] Usage: <main class> [options]
[testng] The XML suite files to run
[testng] Unknown option: -sourcedir
[testng] Options:
[testng] -configfailurepolicy Configuration failure policy (skip or
[testng] continue)
[testng] -d Output directory
[testng] -dataproviderthreadcount Number of threads to use when running
[testng] data providers
[testng] -excludegroups Comma-separated list of group names to
[testng] exclude
[testng] -groups Comma-separated list of group names to be
[testng] run
[testng] -junit JUnit mode
[testng] Default: false
[testng] -listener List of .class files or list of class
[testng] names implementing ITestListener or
[testng] ISuiteListener
[testng] -methods Comma separated of test methods
[testng] Default: []
[testng] -methodselectors List of .class files or list of class
[testng] names implementing IMethodSelector
[testng] -objectfactory List of .class files or list of class
[testng] names implementing ITestRunnerFactory
[testng] -parallel Parallel mode (methods, tests or classes)
[testng] -port The port
[testng] -reporter Extended configuration for custom report
[testng] listener
[testng] -suitename Default name of test suite, if not
[testng] specified in suite definition file or
[testng] source code
[testng] -suitethreadpoolsize Size of the thread pool to use to run
[testng] suites
[testng] Default: 1
[testng] -testclass The list of test classes
[testng] -testjar A jar file containing the tests
[testng] -testname Default name of test, if not specified in
[testng] suitedefinition file or source code
[testng] -testnames The list of test names to run
[testng] -testrunfactory, -testRunFactory The factory used to create tests
[testng] -threadcount Number of threads to use when running
[testng] tests in parallel
[testng] -usedefaultlisteners Whether to use the default listeners
[testng] Default: true
[testng] -log, -verbose Level of verbosity
[testng]
stop-server:
[selenium-shutdown] Getting: http://localhost:4444/selenium-server/driver/?cmd=shutDown
[selenium-shutdown] To: /var/lib/jenkins/jobs/HomePage/workspace/result.txt
[selenium-shutdown] DGF Errors during shutdown are expected
My Jenkins instance runs on a different box (ubuntu). I just upgraded to Ant 1.8.2 on that box. Can this be a testng issue? I've seen this issue a few places but no concrete answers yet, any help is appreciated, thanks.
For some reason, Jenkins is passing "-sourcedir" to TestNG, which is not a recognized option.