Login

Login
  • Register
  • VectorDesign blog

    Testing Automation and general Tech Geek stuff

    extracting value from input field

    System.out.println(“attribute value”+driver.findElement(By.id(“someid”)).getAttribute(“value”)); JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver; System.out.println(“JavaScript”+javascriptExecutor.executeScript(“return arguments[0].value”, driver.findElement(By.id(“someid”))));

    Sunday, May 5th, 2019

    Set up Edge WebDriver

      Find your win10 release Win + R. Open up the run command with the Win + R key combo. locate the release in the pop up navigate to Microsoft WebDriver official page find the matching version download the web driver corresponding to your build set WebDriver in your path System.setProperty(“webdriver.edge.driver”, “{PathToDriver}/MicrosoftWebDriver.exe”); done    

    Thursday, July 5th, 2018

    WordPress Admin Log In Automation Test

    Using Selenium to test administrator functionality for wordpress

    Wednesday, January 10th, 2018

    JUnit Annotations Cheat Sheet

    @Before is executed before each test, @BeforeClass runs once before the entire test fixture. If your test class has ten tests, @Before code will be executed ten times, but @BeforeClass will be executed only once. In general, you use @BeforeClass when multiple tests need to share the same computationally expensive setup code. Establishing a database connection falls into this category. You can move […]

    Wednesday, September 13th, 2017

    Grading Selenium Tests

    Test One thing ATOMIC TESTING Each Test should be able to run Independently  ( autonomous) Anyone should understand the code Group Similar Tests together Centralized Setups and Tear Downs Use Page Objects

    Friday, January 20th, 2017

    Linux Screen Cheat Sheet

    You can use Linux Screen to run tests  without maintaining an active shell session. To do that start Linux Screen by typing screen in the console  you can either close the session or hit Ctrl + a , d. To reattach to the screen. To Reconnect  type screen -r . if you have more than […]

    Tuesday, January 10th, 2017

    switching between iframes WebDriver

    TestVariables.driver.switchTo().frame(TestVariables.driver.findElement(By.xpath(“//html/body/div[3]/div[1]/div/div[2]/div[2]/div/div/div[3]/form/div[6]/div/div/iframe”))); TestVariables.driver.switchTo().defaultContent();

    Friday, July 15th, 2016

    Installing apk on android Emulator using ADB

    locate your sdk installation folder (windows c:\Users\{user}\AppData\Local\Android\Sdk\platform-tools) locate adb.exe Open Terminal in that folder ( Shift + right click) open command window here type adb.exe – e install {path to apk}  

    Tuesday, July 12th, 2016

    Selenium Select from Dropdown

    new Select(driver.findElement(By.id(“DropDownId”))).selectByVisibleText(“Germany”);

    Tuesday, July 5th, 2016

    junit get test name

    import org.junit.Rule; public class NameRuleTest { @Rule public TestName name = new TestName(); @Test public void testA() { assertEquals(“testA”, name.getMethodName()); } @Test public void testB() { assertEquals(“testB”, name.getMethodName()); } }

    Thursday, June 30th, 2016

    Firefox Plug ins for testing

    Selenium IDE (firefox)   Selenium IDE Chrome Nimbus Screen Capture and edit

    Friday, June 10th, 2016

    Selenium Grid

    Grid allows you to : scale by distributing tests on several machines ( parallel execution ) manage multiple environments from a central point, making it easy to run the tests against a vast combination of browsers / OS. Selenium Grid allows us to run multiple instances of WebDriver or Selenium Remote Control in parallel. It […]

    Saturday, January 9th, 2016
    Monday, November 30th, 2015

    Manually upgrade Jenkins

    1. download the version of jenkins you want to use 2. Navigate to /usr/share/jenkins 3 Replace the war file   Restart the service

    Thursday, July 30th, 2015

    Starting Selenium hub and nodes

    starting hub java -jar selenium-server-standalone-2.44.0.jar -role hub Starting node java -jar selenium-server-standalone-2.44.0.jar -role node -hub http://localhost:4444/grid/register If you want to set a specific port java -jar selenium-server-standalone-2.44.0.jar -role hub -port 4441

    Wednesday, July 22nd, 2015

    handle browser user authentication pop up

    One of the usual problems in testing is getting access to the test environment. Usually a test server is setup where a users authentication is required in order to access the application under test. In most  browsers (firefox,chrome, safari ect) this can be easily achieved by parsing the credentials in the url like so http://USERNAME:PASSWORD@www.testdomain.com […]

    Tuesday, July 21st, 2015

    JAVA ROBOTS

    This class is used to generate native system input events for the purposes of test automation, self-running demos, and other applications where control of the mouse and keyboard is needed. The primary purpose of Robot is to facilitate automated testing of Java platform implementations.   http://docs.oracle.com/javase/7/docs/api/java/awt/Robot.html

    Tuesday, July 21st, 2015

    Setting up Credentials for HtmlUnitDriver

    TestVariables.driver = new HtmlUnitDriver(true) { protected WebClient modifyWebClient(WebClient client) { // This class ships with HtmlUnit itself DefaultCredentialsProvider creds = new DefaultCredentialsProvider(); // Set some example credentials creds.addCredentials(“USERNAME”, “PASSWORD”); // And now add the provider to the webClient instance client.setCredentialsProvider(creds); return client; } };

    Tuesday, July 21st, 2015

    Starting Remote WebDrivers

      DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability(“version”, “3.6”); capabilities.setCapability(“platform”, Platform.LINUX); WebDriver = driver = new RemoteWebDriver( new URL(“http://***.***.*.**:****/wd/hub”), capabilities); TestVariables.driver.get(“http://www.google.com”);  

    Tuesday, July 21st, 2015

    Get Driver Information

    Capabilities caps = ((RemoteWebDriver) driver).getCapabilities(); String browserName = caps.getBrowserName(); String browserVersion = caps.getVersion();

    Friday, June 26th, 2015

    Use common @before and @after Class

    create a public abstract class TestSetUps and include your annotations @Rule @Before @After   When you create a new test class extend it to the TestSetUps Class   You can over ride either using the @Override annotation     @Override @After public void tearDown() throws Exception { }

    Monday, June 8th, 2015

    Technologies used for Testing automation

    Selenium WebDriver / Grid   Simulates user interphase with the web application and distributes tests among a network Selenium IDE   Firefox Plug in that helps non coders to produce C# test scripts for test case expansion and maintenance Nunit Unit Testing environment used to run test scripts and report Oracle Virtual Box  system emulator

    Friday, May 22nd, 2015

    Automation Testing Best Practices

    Use a locators file Name Junit test scripts with a common end name (e.x. EndUserTests.class) Use common @before and @after Class to run Tests Take Screenshot on fail

    Tuesday, May 19th, 2015

    Java Robots and Selenium

    Still if you want to move the mouse pointer physically, you need to take different approach using Robot class Point coordinates = driver.findElement(By.id(“ctl00_portalmaster_txtUserName”)).getLocation(); Robot robot = new Robot(); robot.mouseMove(coordinates.getX(),coordinates.getY()+120); Webdriver provide document coordinates, where as Robot class is based on Screen coordinates, so I have added +120 to compensate the browser header. Screen Coordinates: These […]

    Thursday, March 19th, 2015

    Change Firefox Path in Selenium

    File pathToBinary = new File(“C:\\Program Files\\Mozilla Firefox15\\Firefox.exe”); FirefoxBinary ffBinary = new FirefoxBinary(pathToBinary); FirefoxProfile firefoxProfile = new FirefoxProfile(); FirefoxDriver _driver = new FirefoxDriver(ffBinary,firefoxProfile);

    Wednesday, March 11th, 2015
    Thursday, February 19th, 2015

    Jetkins and Selenium Questions And Answers

    Install Jenkins (we already have that on our server) None needed. Install plugins for Jenkins (which ones?) As far as I remember no specific plugin is required just for this purpose. Jenkins should be able to run maven or ant job, it’s out of the box. Install xvfb so tests are run in a headless […]

    Wednesday, February 18th, 2015

    Selenium Webdriver Refresh page

    driver.navigate().refresh();

    Thursday, November 13th, 2014

    Selenium WebDriver Selectors

    Locating UI Elements (WebElements) Locating elements in WebDriver can be done on the WebDriver instance itself or on a WebElement. Each of the language bindings expose a “Find Element” and “Find Elements” method. The first returns a WebElement object otherwise it throws an exception. The latter returns a list of WebElements, it can return an […]

    Tuesday, September 2nd, 2014