How to resolve ElementNotInteractableException: Element is not visible in Selenium webdriver?

ElementNotInteractableException ElementNotInteractableException is the W3C exception which is thrown to indicate that although an element is present on the HTML DOM, it is not in a state that can be interacted with. Reasons & Solutions : The reason for ElementNotInteractableException to occur can be numerous. Temporary Overlay of other WebElement over the WebElement of our … Read more

Set Chrome’s language using Selenium ChromeDriver

You can do it by adding Chrome’s command line switches “–lang”. Basically, all you need is starting ChromeDriver with an ChromeOption argument –lang=es, see API for details. The following is a working example of C# code for how to start Chrome in Spanish using Selenium. ChromeOptions options = new ChromeOptions(); options.addArguments(“–lang=es”); ChromeDriver driver = new … Read more

Webdriver Screenshot in Python

Use driver.save_screenshot(‘/path/to/file’) or driver.get_screenshot_as_file(‘/path/to/file’): import selenium.webdriver as webdriver import contextlib @contextlib.contextmanager def quitting(thing): yield thing thing.quit() with quitting(webdriver.Firefox()) as driver: driver.implicitly_wait(10) driver.get(‘http://www.google.com’) driver.get_screenshot_as_file(‘/tmp/google.png’) # driver.save_screenshot(‘/tmp/google.png’)

Protractor in STS IDE -> Could not find update-config.json

It looks like you are either using directConnect or launching with a local driver provider (not having seleniumAddress or directConnect) in your configuration file. You need to run webdriver-manager update. Previously I had extra flags to not download standalone or gecko with webdriver-manager update –standalone false –gecko false. This is no longer the case if … Read more

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

How to handle print dialog in Selenium?

Unfortunately, WebDriver can’t handle these (or any other browser or OS dialog). Moreover, they tend to look differently across browsers / systems / language settings, so there’s probably no definite answer. You’ll need to detect and handle every possible case in order to make it work everywhere. Your options include: The Robot class, it allows … 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);