Running Chrome WebDriver on a linux server with no display

I was facing the same challenge of setting a linux box with selenium + chromedriver, and here’s my notes: Pre-reqs: Install JRE to run the selenium jar Install the selenium server grab the jar file from https://code.google.com/p/selenium/downloads/list) Install xvfb (you’ve seem to have already achieved this part) Install google-chrome for your linux distribution Download the … Read more

How can selenium web driver get to know when the new window has opened and then resume its execution

You need to switch the control to pop-up window before doing any operations in it. By using this you can solve your problem. Before opening the popup window get the handle of main window and save it. String mwh=driver.getWindowHandle(); Now try to open the popup window by performing some action: driver.findElement(By.xpath(“”)).click(); Set s=driver.getWindowHandles(); //this method … Read more

How to get entered text from a textbox in Selenium

The getText() method is for retrieving a text node between element tags for example: <p>Something</p> getText() will return “Something” In a textbox typed text goes into the value attribute so you can try something like: findElement(By.id(“someid”)).getAttribute(“value”); ComboBox is a bit different. But if you’re using the Select object you can use the method: Select selectItem … Read more

webdriver classname with space using java

Instead of class name you can use a css selector. You don’t mention the tagname for the class ‘current time’. I am assuming it to be input, so your css selector work be, WebElement element = driver.findElement(By.cssSelector(“input[class=”current time”]”)); element.click(); Edit#1 Based on html provided, Looking at the html in your comment, it seems you have … Read more

Using Selenium how to get network request [closed]

Not exactly open by dev tools but found some network, performance and other results. Yes you can do that using JavascriptExecutor Below Code will give you all performance, network etc entries:- ChromeOptions options = new ChromeOptions(); options.addArguments(“start-maximized”); DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability(ChromeOptions.CAPABILITY, options); WebDriver driver = new ChromeDriver(capabilities); driver.get(“http://www.google.com”); String scriptToExecute = “var performance = … Read more