Selenium Webdriver – click on hidden elements

Try this: WebElement elem = yourWebDriverInstance.findElement(By.xpath(“//*[@class=”goog-menu goog-menu-vertical uploadmenu density-tiny”]/input”)); String js = “arguments[0].style.height=”auto”; arguments[0].style.visibility=’visible’;”; ((JavascriptExecutor) yourWebDriverInstance).executeScript(js, elem); The above bunch would change the visibility of your file input control. You can then proceed with the usual steps for file upload like: elem.sendKeys(“<LOCAL FILE PATH>”); Be aware, by changing the visibility of an input field you … Read more

Which Firefox version is compatible with Selenium 3.6.0

Selenium with Gecko Driver Selenium Release Perspective : Selenium v3.6.0 (Java) Release explicitly didn’t mention any dependency explicitly. The last dependency explicitly mentioned by Selenium was for v3.4.0 which is as follows : Geckodriver 0.16 is strongly recommended GeckoDriver Release Perspective : GeckoDriver v0.19.0: Firefox 55.0 (and greater) & Selenium 3.5 (and greater) GeckoDriver v0.18.0: … Read more

I need to find an element in Selenium by CSS

Only using class names is not sufficient in your case. By.cssSelector(“.ban”) has 15 matching nodes By.cssSelector(“.hot”) has 11 matching nodes By.cssSelector(“.ban.hot”) has 5 matching nodes Therefore you need more restrictions to narrow it down. Option 1 and 2 below are available for CSS selector, 1 might be the one that suits your needs best. Option … Read more

What is the difference between a CSS and XPath selector? And which is better with respect to performance for cross-browser testing?

CSS selectors perform far better than XPath selectors, and it is well documented in Selenium community. Here are some reasons: XPath engines are different in each browser, hence making them inconsistent Internet Explorer does not have a native XPath engine, and therefore Selenium injects its own XPath engine for compatibility of its API. Hence we … Read more

Selenium Webdriver wait Expected condition failed: waiting for visibility of element located by By.id

As per the Java Docs of WebDriverWait Class if you want to change the Polling Interval you need to change it in the constructor as the constructor is as follows : WebDriverWait(WebDriver driver, long timeOutInSeconds, long sleepInMillis) Wait will ignore instances of NotFoundException that are encountered (thrown) by default in the ‘until’ condition, and immediately … Read more

What is the difference between a CSS selector and XPath? And which is better with respect to performance for cross-browser testing?

CSS selectors perform far better than Xpath and it is well documented in Selenium community. Here are some reasons, Xpath engines are different in each browser, hence make them inconsistent IE does not have a native xpath engine, therefore selenium injects its own xpath engine for compatibility of its API. Hence we lose the advantage … Read more

Textbox events?

Welcome to SO. There are different option to get the associated events. Let’s take the stackoverflow search box (the one which is on the top with s-input js-search-field class) 1) Using getEventListeners Go to chrome console in the dev tools and then use getEventListeners(element). getEventListeners(document.querySelector(‘.s-input.js-search-field ‘)) 2) Using Dev Tools Event Listner Go to chrome … Read more