Selenium using Python – Geckodriver executable needs to be in PATH

I’m new to programming and started with Python about two months ago and am going over Sweigart’s Automate the Boring Stuff with Python text. I’m using IDLE and already installed the Selenium module and the Firefox browser. Whenever I tried to run the webdriver function, I get this: from selenium import webdriver browser = webdriver.Firefox() … Read more

Get HTML source of WebElement in Selenium WebDriver using Python

I’m using the Python bindings to run Selenium WebDriver: from selenium import webdriver wd = webdriver.Firefox() I know I can grab a webelement like so: elem = wd.find_element_by_css_selector(‘#my-id’) And I know I can get the full page source with… wd.page_source But is there a way to get the “element source”? elem.source # <– returns the … Read more

element not interactable exception in selenium web automation

Try setting an implicit wait of maybe 10 seconds. gmail.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); Or set an explicit wait. An explicit waits is code you define to wait for a certain condition to occur before proceeding further in the code. In your case, it is the visibility of the password input field. (Thanks to ainlolcat’s comment) WebDriver gmail= … Read more

Call a Class From another class

Suposse you have Class1 public class Class1 { //Your class code above } Class2 and then you can use Class2 in different ways. Class Field public class Class1{ private Class2 class2 = new Class2(); } Method field public class Class1 { public void loginAs(String username, String password) { Class2 class2 = new Class2(); class2.invokeSomeMethod(); //your … Read more

How to open a new tab using Selenium WebDriver in Java?

Just for anyone else who’s looking for an answer in Ruby, Python, and C# bindings (Selenium 2.33.0). Note that the actual keys to send depend on your OS. For example, Mac uses CMD + T, instead of Ctrl + T. Ruby require ‘selenium-webdriver’ driver = Selenium::WebDriver.for :firefox driver.get(‘http://stackoverflow.com/’) body = driver.find_element(:tag_name => ‘body’) body.send_keys(:control, ‘t’) driver.quit Python from selenium import webdriver … Read more

Selenium Webdriver: Element Not Visible Exception

You have two buttons with given xpath on this page, first is not visible, thats why you are getting ElementNotVisibleException One is under <div class=”loginPopup”> Second (the one you need) is under <div class=”page”> So change your xpath to look like this, and it will fix your problem: By.xpath(“//div[@class=”page”]//div[@id=’_loginButton’]”)