Selenium WebDriver.get(url) does not open the URL

It is a defect of Selenium. I have the same problem in Ubuntu 12.04 behind the proxy. Problem is in incorrect processing proxy exclusions. Default Ubuntu exclusions are located in no_proxy environment variable: no_proxy=localhost,127.0.0.0/8 But it seems that /8 mask doesn’t work for selenium. To workaround the problem it is enough to change no_proxy to … Read more

Is it possible to use Selenium WebDriver to drive PhantomJS?

PhantomJS now includes the GhostDriver project. You are also suggested to use PhantomJS directly or with a convenience library such as CasperJS. CasperJS is specifically designed to make it easy to do sequential operations to web pages, perfect for many automation tasks. Disclaimer: I am the author of PhantomJS. Edit: As noted in Nick’s answer, … Read more

How to download an image using Selenium (any version)?

I prefer doing something like this : 1. Get the SRC attribute of the image. 2. Use ImageIO.read to read the image onto a BufferedImage 3. Save the BufferedImage using ImageIO.write function For e.g. String src = imgElement.getAttribute(‘src’); BufferedImage bufferedImage = ImageIO.read(new URL(src)); File outputfile = new File(“saved.png”); ImageIO.write(bufferedImage, “png”, outputfile);

Check if a WebElement is stale without handling an exception

Webdriver itself uses the try/catch-construction to check for staleness as well. from org.openqa.selenium.support.ui.ExpectedConditions.java: public static ExpectedCondition<Boolean> stalenessOf(final WebElement element) { return new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver ignored) { try { // Calling any method forces a staleness check element.isEnabled(); return false; } catch (StaleElementReferenceException expected) { return true; } } @Override public String … Read more

Only local connections are allowed Chrome and Selenium webdriver

This is just an informational message. Your issue might be a missmatch between the versions of chromedriver and selenium-server-standalone. Try with the latest selenium version 3.0, it is working for me. Please not that for selenium 3.0 you need to specify the driver first and after the selenium server. With the new selenium, which is … Read more

Difference between Selenium RC and WebDriver

Quoting from WebDriver and Selenium RC: Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation. How these direct calls are made, and the features they support depends on the browser you are using. Information on each ‘browser driver’ is provided later in this chapter. For those familiar with Selenium-RC, this … Read more

Selenium @FindBy vs driver.findElement()

Roughly speaking, @FindBy is just an alternate way of finding elements (the “usual way” being driver.findElement() as you said). The big advantage of that annotation is not itself, though. It is better used to support the PageObject pattern. In a few words, the PageObject pattern tells you to create a class for each page of … Read more

Load chrome extension using selenium

I did this with Python in case anyone was looking. All you have to do is download the .crx file (I used https://chrome-extension-downloader.com/) and save it somewhere that Python can access it. In my example, I imported it to the same folder as my Python script, to load exampleOfExtensionDownloadedToFolder.crx. from selenium import webdriver from selenium.webdriver.chrome.options … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)