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

    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

    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

    Selenium Select from Dropdown

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

    Tuesday, July 5th, 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

    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

    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

    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