Home page

Showing posts with label Setup. Show all posts
Showing posts with label Setup. Show all posts

Wednesday, December 4, 2019

How to install Protractor on Windows machine

Steps to install Protractor on Windows machine:

1. Go to https://nodejs.org/en/download/ 
2. Download Windows Installer (.msi) and install it.
In next step we will check correctly installed or not:
3. Open command prompt and execute this command: node --version
4. Command to check npm is: npm --version
[npm means node package manager which is command line utility to download open source software. Here it will be useful in Protractor installation.]
In next step we will install Protractor by using npm:
5. Command to install Protractor globally is: npm install -g protractor [We use globally when need to execute Protractor from any directory of the system]
6. Execute command to check version of the installed Protractor: protractor --version
7. Install webdriver managet to run selenium server and command is: webdriver-manager update
8. To start the selenium server command is: webdriver-manager start
In next step let's check script execution:
9. Open command prompt and go to example folder of Protractor. [e.g; C:\Users\<username>\AppData\Roaming\npm\node_modules\protractor\example] Here, username is your window system's user.
10. Execute command to run script is: protractor conf.js

Note: If you are getting any error to run example then recheck followed steps.

Monday, December 2, 2019

Do JAVA and Maven configuration in Jenkins

Steps to do JAVA and Maven configuration with Jenkins
  1. Go to Manage Jenkins from options listed on the left side.
  2. Go to Global Tool Configuration
  3. Click 'Add JDK' button under 'JDK' panel.
  4. Uncheck "Install Automatically" checkbox. [This comes bydefault checked to install latest Java version automatically]
  5. Enter JAVA_HOME in Name textbox.
  6. Enter jdk folder path path in JAVA_HOME textbox.[e.g; c:\Program Files\Java\jdk1.8.0]
  7. Scroll down and click 'Add Maven' button under 'Maven' panel.
  8. Uncheck "Install Automatically" checkbox. [This comes bydefault checked to install latest maven version automatically]
  9. Enter MAVEN_HOME in Name textbox.
  10. Enter maven path in MAVEN_HOME textbox. [e.g; D:\Software\Maven\apache-maven-3.4] If it is not installed then first install.
  11. Click Save button.

Friday, November 29, 2019

Jenkins Install Suggested Plugins

Following plugins Jenkins recommend to install while configuring first time:
  1. Folders
  2. Timestamper
  3. Pipeline
  4. Git
  5. PAM Authentication
  6. OWASP Markup  Formatter
  7. Workspace Cleanup
  8. GitHub Branch Source
  9. Subversion
  10. LDAP
  11. Build Timeout
  12. Ant
  13. Pipeline: GitHub Groovy Libraries
  14. SSH Slaves
  15. Email Extension
  16. Credentials Binding
  17. Gradle
  18. Pipeline: Stage View
  19. Matrix Authorization Strategy
  20. Mailer

Thursday, July 18, 2019

maven error: Could not calculate build plan

maven error:

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6


Solution:

Right click project > Maven > Update Project: Check “Force Update of Snapshots/Release” checkbox and click OK button.
 

Monday, June 11, 2018

Check if value is integer or not

public static boolean isInteger(String str) {
if (str == null) {
return false;
}
int length = str.length();
if (length == 0) {
return false;
}

for (int i = 0; i < length; i++) {
char c = str.charAt(i);
if (c < '0' || c > '9') {
return false;
}
}
return true;
}

Generate Random Number

public static String generateRandomNumber() {
Calendar c = Calendar.getInstance();
String str = String.valueOf(c.get(Calendar.YEAR)) + String.valueOf(c.get(Calendar.MONTH)) + String.valueOf(c.get(Calendar.DAY_OF_MONTH)) + String.valueOf(c.get(Calendar.HOUR_OF_DAY)) + String.valueOf(c.get(Calendar.MINUTE)) + String.valueOf(c.get(Calendar.SECOND));
return str;
}

Monday, October 23, 2017

Create a Selenium Webdriver Maven Project using TestNG in Eclipse

Steps:

  1. Create Maven project.
  2. Remove app.java from src/main/java
  3. Remove apptest.java from src/test/java
  4. Create java file in src/test/java
  5. Create testng.xml and enter class name
  6. Enter dependencies in pom.xml as mentioned below 
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
          </dependency>

              <dependency>
                <groupId>org.testng</groupId>
                  <artifactId>testng</artifactId>
                    <version>6.14.3</version>
                      <scope>test</scope>
                        </dependency>

                            <dependency>
                              <groupId>org.uncommons</groupId>
                                <artifactId>reportng</artifactId>
                                  <version>1.1.4</version>
                                    <scope>test</scope>
                                      </dependency>

                                          <dependency>
                                            <groupId>org.apache.poi</groupId>
                                              <artifactId>poi</artifactId>
                                                <version>4.1.0</version>
                                                  </dependency>

                                                      <dependency>
                                                        <groupId>org.apache.poi</groupId>
                                                          <artifactId>poi-ooxml</artifactId>
                                                            <version>4.1.0</version>
                                                              </dependency>

                                                              Monday, October 27, 2014

                                                              Setup

                                                              import java.util.concurrent.TimeUnit;

                                                              import org.openqa.selenium.WebDriver;
                                                              import org.openqa.selenium.firefox.FirefoxDriver;


                                                              public class SetUp {

                                                                  public static WebDriver driver;
                                                                 
                                                                  public void firefoxSetup()
                                                                  {
                                                                      driver = new FirefoxDriver();
                                                                      driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
                                                                      driver.get("http://www.google.com/");
                                                                      driver.manage().window().maximize();
                                                                  }
                                                                 
                                                                  public void quitFireFox()
                                                                  {
                                                                      driver.quit();
                                                                  }
                                                              }