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

Is it possible to take a screenshot of the whole page with Selenium/Capybara?

In case anyone washed up this shore looking for how to do this with Poltergeist you just need to pass the full argument: page.save_screenshot(‘screen.png’, full: true) # If providing a custom file name. page.save_screenshot(full: true) # Capybara sets a name based on timestamp. page.save_and_open_screenshot(‘screen.png’, full: true) # Same as save_screenshot. page.save_and_open_screenshot(full: true) # Same as … Read more

ERROR:ssl_client_socket_openssl.cc(1158)] handshake failed with ChromeDriver Chrome browser and Selenium

You get this error when the browser asks you to accept the certificate from a website. You can set to ignore these errors by default in order avoid these errors. For Chrome, you need to add –ignore-certificate-errors and –ignore-ssl-errors ChromeOptions() argument: options = webdriver.ChromeOptions() options.add_argument(‘–ignore-certificate-errors’) options.add_argument(‘–ignore-ssl-errors’) driver = webdriver.Chrome(chrome_options=options) For the Firefox, you need to … 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’s the relationship between Selenium RC and WebDriver?

You should probably start your research here (though you may have already gone over this): http://seleniumhq.org/docs/03_webdriver.html I’ll assume you’re contrasting Selenium-RC to WebDriver, Selenium-IDE really isn’t in the same ballpark. Selenium uses JavaScript to automate web pages. This lets it interact very tightly with web content, and was one of the first automation tools to … Read more

wait.until(ExpectedConditions) doesnt work any more in selenium

I had the same issue. I fixed it by using the not deprecated .until() method of WebDriverWait and by adding the following to my maven pom.xml: <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>21.0</version> </dependency> Other than that, my code looks exactly like before. To be more specific there are now two .until() methods. The old one (which is … Read more

WebDriverError: disconnected: unable to connect to renderer

I had similar error. But versions were matching: I was using Chrome 65 with driver version 2.38. I spent long time, trying to understand the issue. At the end, found that it was caused by empty /etc/hosts file. Apparently Chrome communicates via localhost, and if such entry missing in /etc/hosts – it will crash. So, … Read more

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