SpringBoot Selenium Automation - selenium

I have created Spring Boot web app and its working fine. Now I am writing selenium automation for my web app. I have written some test case. But when I am executing the test cases by using mvn test its giving following exception.
java.lang.NoClassDefFoundError: org/apache/http/auth/Credentials
Can someone tell me why this is error?

You might missing the jar
make sure you have httpclient 4.5.2 or higher in your class path.
refresh eclipse
Close Eclipse.
clean .m2/repository folder
Open Eclipse and Alt+F5 on project;
check option Force Update of Snapshots

Use
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.+</version>
</dependency>
and check

Related

How to download JAR from Maven and add to non-Maven IntelliJ WAR project

I need to setup https://github.com/adminfaces but i can't make it work at all. I get errors in wildfly deployment.
I setup intellij project, i select framework support for JSF, and Primefaces which are prerequisites. But than docs say:
Add admin theme to your classpath:
<dependency>
<groupId>com.github.adminfaces</groupId>
<artifactId>admin-theme</artifactId>
<version>1.0.0-RC9</version>
</dependency>
How do i do this if i don't use maven? Can i set it up, via some jar file. Also i don't get it, if i download release from github, what is install.sh?
But even if i added it through maven via Intellij browser it still doesn't work. Can't deploy to Wildfly.
Maven library can be added to non Maven project through Intellij IDEA.
Project structure->Libraries->Add library->From Maven
AdminFaces jars are published to maven central, you can download it there, see here.
Just add admin-template and admin-theme to your classpath.
Also it depends on OmniFaces (2.x) and PrimeFaces (5.1.1 or greater) and also JavaEE apis such as servlet, EJB, CDI, JSF and JPA.
If you are running it outside a JavaEE container such as Tomcat take a look at Admin Starter Tomcat dependencies, you should be able to download them from maven central as well.

How to install Sikuli in IntelliJ Idea?

I want to automate a Windows app which will also become a mobile app. I am thinking of creating a test automation framework from scratch using IntelliJ.
Since the older tests are already written in Sikuli, I would like to keep them too. What are the steps for setting up Selenium and Sikuli in IntelliJ?
I would recomend you use Maven. In this case you just need to add next dependency to POM.xml
<!-- https://mvnrepository.com/artifact/com.sikulix/sikulixapi -->
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
<version>1.1.999</version>
</dependency>

intellij JavaDoc browser plugin can't find javax

I'm on Arch linux x64 machine , I installed intellij idea but whenever I open a project a startupabortedexception occurs with the JavaDoc browser plugin.
I looked into my idea.log and figured out that it can't find javax.servlet.Servlet, I disabled the plugin in order to open a java project and indeed when I type import javax; it says it can't find javax.
I have java-openjfx installed and still intellij can't find it, what to do in this case ? .
Environment information
jdk:openjdk 1.8.0_60 64 bit.
intellij version: 14.1.5 community edition.
Goal
My goal is to get the JavaDoc browser plugin to work not to program in javax.servlet, I don't intend to do any web development with java right now.
If you don't have Maven project, you can just add the jar to the project. The one you are missing can be downloaded from:
http://mvnrepository.com/artifact/javax.servlet/javax.servlet-api/3.1.0
(just click "Download (JAR)" button)
The class javax.servlet.Servlet is not part of the standard JDK, it is part of the JEE, so you have to add servlet-api.jar to your classpath.
If your project is a Maven project you add the dependency like this:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
And you probably want to add
<scope>provided</scope>
as this dependency is most likely present in your application server.

How to add Java EE Servlet API library on your compile classpath in IntelliJ

I am new to IntelliJ and I have been working on a few small projects to familiarize myself with IDE and how to develop Java web projects with it.
I recently picked up Professional Java for Web Applications to practise my web development skills and I wanted to try it because it focuses on IntelliJ rather than Eclipse.
My main issues are from not knowing my way around the IDE at all. I have come across a problem that I have been unable to figure out how to do correctly.
How do you add Java EE Servlet API library on your compile classpath ?
Where is the compile classpath located in IntelliJ ?
Any help is appreciated!
This depends on how you are managing dependencies in your project.
If you are using Maven simply add it as a dependency in your pom.xml. When IDEA sees a maven based project it will over for you to Import Changes and/or Enable Auto Import. A common JavaEE 7 maven dependency would look like this in your pom.xml:
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
If you are only using an IDEA project to manage things (vs. maven, gradle etc.) then you can go into the project structure dialog, click on modules and select the module containing your web tier code. Then click on the dependencies tab. Then click on plus button (+) and add a JAR, then navigate to the JAR containing the servelet APIs that is bundled with your application server and select that.
There are another half dozen ways to set this up and exactly which one you choose depends on a lot of factors like how you want to manage provided dependencies in your project etc. Either of these methods should get you on your way though.

How to create my first Grails project in IntelliJ, with Maven?

The goal: create my first Grails project, in IntelliJ, with Maven support.
Myself: Noob to Groovy/Grails, has some Maven experience but not too much
The tooling: Groovy 1.7.5, IntelliJ 9.0.3 and Maven 2.0
What I've tried so far, is:
File->New Project
Create Module
Maven Module
Add & choose the Grails Archtype
Right click on the project --> Run --> grails
I'm getting errors:
PHP home is not specified - WTF, does Grails require PHP?
When I previously tried to use IntelliJ to create a Grails project without Maven, I actually managed to run the application - so I don't understand what is missing now.
P.S. I reported this as an issue, vote it up if you want.
If anyone is interested, here is a github project with all the bootstrap done.
Let's leave IntelliJ aside for now and try to get started on the command line.
The following steps work for me (basically repeating the official instructions but using version 1.3.4):
First create an application:
mvn archetype:generate -DarchetypeGroupId=org.grails \
-DarchetypeArtifactId=grails-maven-archetype \
-DarchetypeVersion=1.3.4 \
-DgroupId=example -DartifactId=my-app
And update my-app/pom.xml to use Java 6:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
Then cd into my-app and create the project structure (run maven from inside the project folder):
cd my-app
mvn initialize
Edit the application.properties file to add:
plugins.hibernate=1.3.4
plugins.tomcat=1.3.4
And run the following to install the plugins:
mvn compile
When done, you should be able to start your app
mvn grails:run-app
And to access it at http://localhost:8080/my-app/.
Once you get the above working, importing the project inside IntelliJ should be a trivial step. And if you still get a problem, it will be probably an IntelliJ related issue.
user495750. It's an IntelliJ 9 thing. Nothing I've done (or I suspect ripper234 did). I upgraded an existing Grails project that was working fine from Grails 1.2.0 to 1.3.5 and IntelliJ screws things up. You do nothing to specify a PHP server. Suddenly it thinks there's no server configured.
I managed to get things working by pointing Intellij to the new Grails Home and that fixed things. No need for the Maven incantations. That's a long winded approach. BTW: It's best to get the 1.3.6 version out of Hudson and use that - I had some YUI plugin issues. So I had to do a second update.
Right click project -> Update Grails.. -> New SDK -> point to new Grails Home.
If I recall this invokes a grails upgrade automatically for you to upgrade. Problem solved.
Grails does not require PHP. You got that error because you created PHP run configuration instead Grails run configuration. PHP run configuration may be created on any project by right click on the project --> Run --> ProjectName. It is a PHP support issue.
Grails run configuration will be created automatically after initialization of project structure.