I know a similar question have been asked but the solutions are not helping.example 1 and example 2
I want to click on a link, which at the buttom of the page. I can click on the link from the browser console. The problem is that I can't click on the link with geb and selenium. When I set the required property to true without clicking my test passes without a problem. Which means that geb sees the element in selenium, and I can't understand why I can't click.
Here is a sample of my code:
class MyPage extends Page {
static at = { mybutton }
static content = {
mybutton(wait:true, required:true) { $('a',href:"/folder/folder1/main.jsp?page=changes")}
}
}
This is how I tested it:
class MyTestSuite extends GebReportingSpec {
def 'MyTestFunction' () {
...
then:
at MyPage
and:''
mybutton.click() // unknown error: Element is not clickable at point (699, 2280)
}
}
Then I tried to scroll to the element and click on using interact but this not work because interact is returning null.
and:
interact {
moveToElement(mybutton)
}
This is the stacktrace. the line 77 is where the action mybutton.click() is located.
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 40.669
sec <<< FAILURE! - in myTestSuite
MyTestFunction(myTestSuite) Time elapsed: 27.308 sec <<< ERROR!
org.openqa.selenium.WebDriverException:
unknown error: Element is not clickable at point (699, 2280)
(Session info: chrome=62.0.3202.94)
(Driver info: chromedriver=2.27.440174
(e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.1.7601
SP1
x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 98 milliseconds
Build info: version: '3.3.1', revision: '5234b325d5', time: '2017-03-10
09:10:29 +0000'
System info: host: 'MyPCyyyyy', ip: 'xx.xx.xxx.xxx', os.name: 'Windows
7',
os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false,
mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome=
{chromedriverVersion=2.27.440174
(e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),
userDataDir=MyDir}, takesHeapSnapshot=true, pageLoadStrategy=normal,
databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false,
version=62.0.3202.94, platform=XP, browserConnectionEnabled=false,
nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true,
webStorageEnabled=true, browserName=chrome, takesScreenshot=true,
javascriptEnabled=true, cssSelectorsEnabled=true,
unexpectedAlertBehaviour=}]
Session ID: 6e14ddb8c01ae705bd907a56fd2eba35
at myTestSuite. MyTestFunction(myTestSuite.groovy:77)
Results :
Tests in error:
myTestSuite. MyTestFunction:77 » WebDriver unknow...
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-
plugin:2.19:test (default-test) on project geb-maven-example: There are
test
failures.
[ERROR]
[ERROR] Please refer to D:\eclipse-jee-workspace\folderTest\target\surefire-
reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute
goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test (default-test)
on project geb-maven-example: There are test failures.
Please refer to D:\eclipse-jee-workspace\folderTest\target\surefire-reports
for the individual test results.
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(Lifecyc
leModuleBuilder.java:116)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecyleModuleBuilder.java:80)
at `org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)`
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test
failures.
Please refer to D:\eclipse-jee-workspace\folderTest\target\surefire-
reports for the individual test results.
at
org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:91)
at
org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:318)
at
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditions
Checked(AbstractSurefireMojo.java:880)
at
org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:739)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPlugin
Manager.java:134)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException`