Posts

Showing posts with the label webdriver

TestNG - parallel Test execution, WebDriver nullpointer

TestNG - parallel Test execution, WebDriver nullpointer I am sure it has to be an easy one to solve but nothing comes to my mind at this moment, here is the situation. I have one Singleton class (DriverFactory.class) to set and retrieve a ThreadLocal Object. Two test classes running in parallel (FirstTestClass), (SecondTestClass) and the third TestListenerAdapter class with a method where I want to use the actual running WebDriver instance(it should be bound to the Thread) but here I am getting null pointer exception even if, here is the code import config.DriverFactory; import org.junit.Assert; import org.testng.annotations.Test; import org.openqa.selenium.WebDriver; public class SecondTestClass { WebDriver driver; public SecondTestClass()throws Exception{ DriverFactory.getInstance().setDriver(); driver = DriverFactory.getInstance().getDriver();; } @Test public void testInSecondClass() { System.out.println("n THREAD ID: " + Thread....

Selenium and Java: How do I get all of the text after a WebElement

Image
Selenium and Java: How do I get all of the text after a WebElement I am coding a program in Java using WebDriver and am having a little bit of trouble getting the text after the select webElement. The HTML code for the part of the website that I want is as follows: <div id="content"> <div id="Pagination"></div> <div id="mid"> </div> </div> The textbox class codes for a search bar and a drop down bar of languages My Java code is currently able to open chrome using the chrome driver and is able to type into the search bar. I am however not able to get the text that results from the entry. Image In the image here, I entered "avoir" into the search bar, and I want all of the text inside the boxes after which do not seem to have any id's or names to be used inside the xpath. Can someone please help me in finding how to get and save the text from those fields after the dropdown l...