1

Set-up

Trying to log into this log-in form using Python and Selenium.


Code

url = 'https://activeshop.com.pl/customer/account/login/'
browser.get(url)


# fill out login details 
account_name = '[email protected]' 
password = 'mypassword' 

login_details = {
                'login': account_name,
                'password': password
                }

# inserts account name in login field      
fill_field('id','email',login_details['login'])      

# inserts password in password field
fill_field('id','pass',login_details['password'])   

where,

def fill_field(type, type_path, input):
    if type == 'id':
        field = browser.find_element_by_id(type_path)        
    field.clear()
    field.send_keys(input)

Issue

The above code used to work, but since the site has received a makeover it yields a ElementNotInteractableException: element not interactable when trying to fill the fields.

I've tried Xpaths, CSS selectors and whatnot, but the email address and password aren't filled out.

I can obtain texts on the page via Selenium.

There's something blocking Selenium at the input elements. Any ideas?

2 Answers 2

3

There're more than 1 email on the page and first one is not visible. You can get all elements and then filter for visible one:

field = list(filter(lambda x: x.is_displayed(), browser.find_elements(By.ID, "email")))[0]
field.send_keys("email")
Sign up to request clarification or add additional context in comments.

Comments

1

To send a character sequence to the E-mail and Hasło field you need to induce WebDriverWait for the element_to_be_clickable() and you can use the following Locator Strategy:

  • Using XPATH:

    driver.get("https://activeshop.com.pl/customer/account/login/")
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//span[text()='E-mail']//following::input[@class='input-text' and @id='email']"))).send_keys("[email protected]")
    driver.find_element_by_xpath("//span[text()='Hasło']//following::input[@class='input-text' and @title='Hasło']").send_keys("mypassword")
    
  • Note : You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    
  • Browser Snapshot:

activeshop_com

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.