FluentLenium | mobile automation framework which extends Selenium | Functional Testing library
kandi X-RAY | FluentLenium Summary
Support
Quality
Security
License
Reuse
- Finds a list of WebElement matching the supplied filters .
- Builds message .
- Parses the given input and returns the parsed template .
- Gets a shared web driver .
- Adds the hook definitions to the given list .
- Sanitize base ur .
- Builds the hooks .
- Builds by by class .
- Checks if a constructor is matching .
- Create a new configuration object from the given container .
FluentLenium Key Features
FluentLenium Examples and Code Snippets
Trending Discussions on FluentLenium
Trending Discussions on FluentLenium
QUESTION
With new version of Chromedriver (76) i couldnt use class Actions
with moveToElement
method.
From what i found out i had to update selenium also. But when i update selenium, ive got err:
cucumber.runtime.CucumberException: class steps.MainHooks doesn't have an empty constructor. If you need DI, put cucumber-picocontainer on the classpath
Then i updated appium, fluentlenium and so on and so on..
So my question is, what are right versions of dependecies for newest selenium? I am using Fluentlenium, Cucumber, Junit.
ANSWER
Answered 2019-Aug-14 at 06:54selenium latest version you can use 3.1XX.X
Made updated version required the dependent dependencies. which can be seen in Compile Dependencies section or in IDE you can go to the pom of selenium, where you can see dependency required for them.
you can see the version on the below URL https://mvnrepository.com/artifact/org.seleniumhq.selenium
QUESTION
I want to run simple example in fluentlium but I get an exception in driver
My code:
Config.javapublic class Config extends ConfigurationDefaults {
@Override
public String getWebDriver() {
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
return "chrome";
}
}
@FluentConfiguration(configurationDefaults =fluentleniumTutorial.Config.class)
public class AbstractBaseTest extends FluentTest {}
public class TestExample extends AbstractBaseTest{
@Test
public void testGoogle() {
goTo("http://www.google.com");
}
}
My exception:
> org.openqa.selenium.WebDriverException: Browser failed to start, test [ testGoogle(fluentleniumTutorial.TestExample) ] execution interrupted.
Caused by: [ com.gargoylesoftware.htmlunit.WebWindowListener]
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T14:04:26.12Z'
System info: host: 'DEV09', ip: '10.167.166.143', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
Driver info: driver.version: unknown
at org.fluentlenium.adapter.FluentTestRunnerAdapter.starting(FluentTestRunnerAdapter.java:116)
at org.fluentlenium.adapter.junit.FluentTest.access$000(FluentTest.java:15)
at org.fluentlenium.adapter.junit.FluentTest$1.starting(FluentTest.java:25)
at org.fluentlenium.adapter.junit.FluentTestRule$1.evaluate(FluentTestRule.java:43)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.fluentlenium.adapter.junit.FluentTest$2$1.evaluate(FluentTest.java:55)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)
Caused by: java.util.concurrent.ExecutionException: java.lang.ExceptionInInitializerError
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.fluentlenium.adapter.FluentTestRunnerAdapter.getSharedWebDriver(FluentTestRunnerAdapter.java:181)
at org.fluentlenium.adapter.FluentTestRunnerAdapter.getSharedWebDriver(FluentTestRunnerAdapter.java:142)
at org.fluentlenium.adapter.FluentTestRunnerAdapter.starting(FluentTestRunnerAdapter.java:109)
... 21 more
Caused by: java.lang.ExceptionInInitializerError
at org.fluentlenium.adapter.FluentAdapter.newWebDriver(FluentAdapter.java:146)
at org.fluentlenium.adapter.SharedWebDriverContainer$Impl.createDriver(SharedWebDriverContainer.java:92)
at org.fluentlenium.adapter.SharedWebDriverContainer$Impl.getOrCreateDriver(SharedWebDriverContainer.java:83)
at org.fluentlenium.adapter.SharedWebDriverContainer.getOrCreateDriver(SharedWebDriverContainer.java:28)
at org.fluentlenium.adapter.FluentTestRunnerAdapter.lambda$getSharedWebDriver$0(FluentTestRunnerAdapter.java:172)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.fluentlenium.configuration.ConfigurationException: class org.fluentlenium.configuration.DefaultWebDriverFactories$HtmlUnitWebDriverFactory can't be instantiated.
at org.fluentlenium.configuration.AbstractFactoryRegistryImpl.(AbstractFactoryRegistryImpl.java:57)
at org.fluentlenium.configuration.WebDriversRegistryImpl.(WebDriversRegistryImpl.java:16)
at org.fluentlenium.configuration.WebDrivers.(WebDrivers.java:17)
at org.fluentlenium.configuration.WebDrivers.(WebDrivers.java:15)
... 9 more
Caused by: java.lang.reflect.InvocationTargetException
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.fluentlenium.configuration.AbstractFactoryRegistryImpl.(AbstractFactoryRegistryImpl.java:53)
... 12 more
Caused by: java.lang.NoClassDefFoundError: com/gargoylesoftware/htmlunit/WebWindowListener
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.fluentlenium.configuration.ReflectiveWebDriverFactory.(ReflectiveWebDriverFactory.java:35)
at org.fluentlenium.configuration.DefaultWebDriverFactories$HtmlUnitWebDriverFactory.(DefaultWebDriverFactories.java:113)
... 17 more
Caused by: java.lang.ClassNotFoundException: com.gargoylesoftware.htmlunit.WebWindowListener
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 21 more
ANSWER
Answered 2018-Nov-11 at 09:14See you bottom line exception, ClassNotFoundException: com.gargoylesoftware.htmlunit.WebWindowListener
It's a part of HtmlUnit classes that you need to download and add to your project classpath (lib folder)
See Selenium-WebDriver’s Drivers:
HtmlUnit Driver This is currently the fastest and most lightweight implementation of WebDriver. As the name suggests, this is based on HtmlUnit. HtmlUnit is a java based implementation of a WebBrowser without a GUI. For any language binding (other than java) the Selenium Server is required to use this driver.
QUESTION
I have a springboot application (jar), i want to deploy it to wildfly (war) i have follow this guide: https://thepracticaldeveloper.com/2017/09/02/how-to-deploy-a-spring-boot-war-in-wildfly-jboss/
Application.java:
package de.fred4jupiter.fredbet;
import de.fred4jupiter.fredbet.props.CacheNames;
import de.fred4jupiter.fredbet.props.FredbetProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.pringframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.cloud.aws.autoconfigure.cache.ElastiCacheAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
@SpringBootApplication
@EnableConfigurationProperties(FredbetProperties.class)
@EnableCaching
@EnableAutoConfiguration(exclude = ElastiCacheAutoConfiguration.class)
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(applicationClass, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(applicationClass);
}
private static Class applicationClass = Application.class;
@Bean
public Properties buildProperties() throws IOException {
return PropertiesLoaderUtils.loadProperties(new ClassPathResource("build.properties"));
}
@Bean
public CacheManager cacheManager() {
SimpleCacheManager cacheManager = new SimpleCacheManager();
List caches = new ArrayList();
caches.add(new ConcurrentMapCache(CacheNames.AVAIL_GROUPS));
caches.add(new ConcurrentMapCache(CacheNames.CHILD_RELATION));
caches.add(new ConcurrentMapCache(CacheNames.RUNTIME_CONFIG));
cacheManager.setCaches(caches);
return cacheManager;
}
}
pom.xml:
4.0.0
de.fred4jupiter.fredbet
worldcup2018
0.1-SNAPSHOT
war
worldcup2018
Simple football betting application.
Michael Stähler
scm:git:https://github.com/fred4jupiter/fredbet.git
scm:git:https://github.com/fred4jupiter/fredbet.git
https://github.com/fred4jupiter/fredbet
org.springframework.boot
spring-boot-starter-parent
2.0.0.RELEASE
UTF-8
1.8
${maven.build.timestamp}
yyyy-MM-dd HH:mm
Application.app
org.springframework.boot
spring-boot-devtools
true
org.springframework.boot
spring-boot-configuration-processor
true
org.springframework.boot
spring-boot-starter-log4j2
org.springframework.boot
spring-boot-starter-actuator
org.springframework.boot
spring-boot-starter-logging
org.springframework.boot
spring-boot-starter-security
org.springframework.boot
spring-boot-starter-data-jpa
org.springframework.boot
spring-boot-starter-jdbc
org.springframework.boot
spring-boot-starter-cache
com.google.code.gson
gson
org.mariadb.jdbc
mariadb-java-client
runtime
com.h2database
h2
org.postgresql
postgresql
runtime
mysql
mysql-connector-java
runtime
org.springframework
spring-web
3.0.5.RELEASE
javax.servlet
javax.servlet-api
provided
org.springframework.boot
spring-boot-starter-thymeleaf
org.springframework.boot
spring-boot-starter-web
org.graylog2.log4j2
log4j2-gelf
1.0.3
runtime
org.thymeleaf.extras
thymeleaf-extras-springsecurity4
org.thymeleaf.extras
thymeleaf-extras-java8time
nz.net.ultraq.thymeleaf
thymeleaf-layout-dialect
org.webjars
bootstrap
3.3.7-1
org.webjars
jquery
2.1.4
org.webjars
font-awesome
4.7.0
org.webjars.bower
popper.js
1.11.1
org.apache.commons
commons-lang3
org.liquibase
liquibase-core
com.zaxxer
HikariCP
commons-io
commons-io
2.5
net.coobird
thumbnailator
0.4.8
org.apache.commons
commons-compress
1.12
org.springframework.cloud
spring-cloud-starter-aws
1.1.3.RELEASE
org.hibernate.validator
hibernate-validator
org.apache.tomcat.embed
tomcat-embed-el
provided
org.apache.poi
poi-ooxml
3.15
org.springframework.boot
spring-boot-starter-test
test
org.mockito
mockito-core
test
org.seleniumhq.selenium
selenium-java
test
org.seleniumhq.selenium
htmlunit-driver
test
xml-apis
xml-apis
test
org.fluentlenium
fluentlenium-assertj
0.10.9
test
org.assertj
assertj-core
test
org.hamcrest
hamcrest-junit
2.0.0.0
test
com.tngtech.archunit
archunit-junit
0.4.0
test
worldcup2018
src/main/resources
true
**/build.properties
src/main/resources
false
**/build.properties
org.springframework.boot
spring-boot-maven-plugin
org.codehaus.mojo
buildnumber-maven-plugin
1.4
validate
create
default
true
org.apache.maven.plugins
maven-surefire-plugin
**/*UT.java
**/*MT.java
org.apache.maven.plugins
maven-failsafe-plugin
**/*IT.java
**/*MT.java
integration-test
verify
acceptance
org.apache.maven.plugins
maven-surefire-plugin
2.18.1
**/*AT.java
**/*UT.java
**/*IT.java
**/*MT.java
When i do a mvn package i have this error:
/src/main/java/de/fred4jupiter/fredbet/Application.java:[39,8] cannot access org.springframework.web.WebApplicationInitializer [ERROR] class file for org.springframework.web.WebApplicationInitializer not found
Do you have any idea?
Thanks,
C
ANSWER
Answered 2018-Mar-26 at 12:32Fix typo:
pom.xml
4.0.0
de.fred4jupiter.fredbet
fredbet
2.1.0-SNAPSHOT
war
Fredbet
Simple football betting application.
Michael Stähler
scm:git:https://github.com/fred4jupiter/fredbet.git
scm:git:https://github.com/fred4jupiter/fredbet.git
https://github.com/fred4jupiter/fredbet
org.springframework.boot
spring-boot-starter-parent
2.0.0.RELEASE
UTF-8
1.8
${maven.build.timestamp}
yyyy-MM-dd HH:mm
org.springframework.boot
spring-boot-devtools
true
org.springframework.boot
spring-boot-configuration-processor
true
org.springframework.boot
spring-boot-starter-log4j2
org.springframework.boot
spring-boot-starter-actuator
org.springframework.boot
spring-boot-starter-logging
org.springframework.boot
spring-boot-starter-security
org.springframework.boot
spring-boot-starter-data-jpa
org.springframework.boot
spring-boot-starter-jdbc
org.springframework.boot
spring-boot-starter-cache
com.google.code.gson
gson
org.mariadb.jdbc
mariadb-java-client
runtime
com.h2database
h2
org.postgresql
postgresql
runtime
mysql
mysql-connector-java
runtime
org.springframework.boot
spring-boot-starter-thymeleaf
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-tomcat
javax.servlet
javax.servlet-api
provided
org.graylog2.log4j2
log4j2-gelf
1.0.3
runtime
org.thymeleaf.extras
thymeleaf-extras-springsecurity4
org.thymeleaf.extras
thymeleaf-extras-java8time
nz.net.ultraq.thymeleaf
thymeleaf-layout-dialect
org.webjars
bootstrap
3.3.7-1
org.webjars
jquery
2.1.4
org.webjars
font-awesome
4.7.0
org.webjars.bower
popper.js
1.11.1
org.apache.commons
commons-lang3
org.liquibase
liquibase-core
com.zaxxer
HikariCP
commons-io
commons-io
2.5
net.coobird
thumbnailator
0.4.8
org.apache.commons
commons-compress
1.12
org.springframework.cloud
spring-cloud-starter-aws
1.1.3.RELEASE
org.hibernate.validator
hibernate-validator
org.apache.tomcat.embed
tomcat-embed-el
org.apache.poi
poi-ooxml
3.15
org.springframework.boot
spring-boot-starter-test
test
org.mockito
mockito-core
test
org.seleniumhq.selenium
selenium-java
test
org.seleniumhq.selenium
htmlunit-driver
test
xml-apis
xml-apis
test
org.fluentlenium
fluentlenium-assertj
0.10.9
test
org.assertj
assertj-core
test
org.hamcrest
hamcrest-junit
2.0.0.0
test
com.tngtech.archunit
archunit-junit
0.4.0
test
fredbet
src/main/resources
true
**/build.properties
src/main/resources
false
**/build.properties
org.springframework.boot
spring-boot-maven-plugin
org.codehaus.mojo
buildnumber-maven-plugin
1.4
validate
create
default
true
org.apache.maven.plugins
maven-surefire-plugin
**/*UT.java
**/*MT.java
org.apache.maven.plugins
maven-failsafe-plugin
**/*IT.java
**/*MT.java
integration-test
verify
acceptance
org.apache.maven.plugins
maven-surefire-plugin
2.18.1
**/*AT.java
**/*UT.java
**/*IT.java
**/*MT.java
code:
package de.fred4jupiter.fredbet;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.cloud.aws.autoconfigure.cache.ElastiCacheAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
import de.fred4jupiter.fredbet.props.CacheNames;
import de.fred4jupiter.fredbet.props.FredbetProperties;
/**
* Main application start.
*
* NOTE: To disable thymeleaf caching correctly please activate the dev profile
* on local development.
*
* @author michael
*
*/
@SpringBootApplication
@EnableConfigurationProperties(FredbetProperties.class)
@EnableCaching
@EnableAutoConfiguration(exclude = ElastiCacheAutoConfiguration.class)
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) {
SpringApplication app = new SpringApplication(Application.class);
app.addInitializers(new AppInitializer());
app.run(args);
}
@Bean
public Properties buildProperties() throws IOException {
return PropertiesLoaderUtils.loadProperties(new ClassPathResource("build.properties"));
}
@Bean
public CacheManager cacheManager() {
SimpleCacheManager cacheManager = new SimpleCacheManager();
List caches = new ArrayList();
caches.add(new ConcurrentMapCache(CacheNames.AVAIL_GROUPS));
caches.add(new ConcurrentMapCache(CacheNames.CHILD_RELATION));
caches.add(new ConcurrentMapCache(CacheNames.RUNTIME_CONFIG));
cacheManager.setCaches(caches);
return cacheManager;
}
}
QUESTION
I have a web page which contains 2 links with the same classnames but with different div classes. The first one is invisible (it's in a dropdown menu) and the other one that I want is visible. So, I'm trying to locate the visible element.
His HTML :
The link has a dynamic ID. When I do a XPath search with the ID, I find rightly the element but it's deprecated because the button hasn't the same ID on each page.
I tried to locate the element with Selenium IDE, the following locator worked : css=div.mainActionPanel > a.create
The problem is with the locator that I showed above. When I try to find the element, I always have this exception :
NoSuchElementException : Element By.cssSelector: css=div.mainActionPanel > a.create (first) (LazyElement) is not present.
He doesn't find it. I tried several syntax like an example in the FluentLenium documentation ($("form > input[data-custom=selenium]"
) but it doesn't worked.
Moreover, the el(".create").click()
is throwing an ElementNotVisibleException because he selects the dropdown link.
How can I find the right element ?
ANSWER
Answered 2017-May-29 at 12:27May be this should help you..
// this will provide you list of web elements based on class name
List webElements = driver.findElements(By.className("mainActionPanel"));
Then you have to find out the required element by iterating through the list, like below.
WebElement tempElement = null;
for (WebElement element : webElements) {
if (element.getAttribute("css").equals("create")) {
tempElement = element;
}
}
Full code as follow,
List webElements = driver.findElements(By.className("mainActionPanel"));
WebElement tempElement = null;
for (WebElement element : webElements) {
if (element.getAttribute("css").equals("create")) {
tempElement = element;
}
}
//then you can perform that you want
tempElement.click();
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install FluentLenium
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page