0

I am trying to login into following website through selenium python

https://www.talentwise.com/screening/login.php

when I enter username, password and click sigin everything gets all cleared without any error message on ui.(Code is working fine locally,but not on our Linux server)

    options = Options()
    options.add_argument("--headless")
    options.add_argument("--no-sandbox")
    options.add_argument("window-size=1200,1100")
    options.binary_location = "parts/chromium/chromium/chrome"
    self.driver = webdriver.Chrome(
        chrome_options=options,
        executable_path='parts/chromium/chromedriver/chromedriver',
    )
    self.driver.maximize_window()
    self.driver.get(url)
    WebDriverWait(self.driver, delay).until(
        EC.presence_of_element_located(
            (By.XPATH, "//input[@id='EmailAddr']")
        )
    ).send_keys(username)
    WebDriverWait(self.driver, delay).until(
        EC.presence_of_element_located(
            (By.XPATH, "//input[@id='Password']")
        )
    ).send_keys(password)
    WebDriverWait(self.driver, delay).until(
        EC.presence_of_element_located(
            (By.XPATH, "//input[@id='SignIn' and @type='submit' and @value='Sign In']")
        )
    ).click()
2
  • Which error did you receive? Does your script use virtualdisplay? Commented Jun 15, 2020 at 10:52
  • no, there are no errors. Just username and password fields get cleared out on clicking sigin. No not using any kind of script. Commented Jun 15, 2020 at 10:58

1 Answer 1

1

To send a character sequence to the Email Address and Password field you have to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using CSS_SELECTOR:

    driver.get('https://www.talentwise.com/screening/login.php')
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input#EmailAddr"))).send_keys("[email protected]")
    driver.find_element_by_css_selector("input#Password").send_keys("OmkarSalgaonkar")
    driver.find_element_by_css_selector("input#SignIn").click()
    
  • Using XPATH:

    driver.get('https://www.talentwise.com/screening/login.php')
    WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//input[@id='EmailAddr']"))).send_keys("[email protected]")
    driver.find_element_by_xpath("//input[@id='Password']").send_keys("OmkarSalgaonkar")
    driver.find_element_by_xpath("//input[@id='SignIn']").click()
    
  • 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:

sterling

Sign up to request clarification or add additional context in comments.

2 Comments

Hi Debanjan, Thanks for your answer and your time really appreciated it. As you said I have already used "WebDriverWait" and I am able to Login on my local machine, But when I push my code to our Linux server it dose not (like clicking on signing button will clear my username password). Do I need some additional libs on our Linux server ?
@OmkarSalgaonkar WebDriverWait is a vast topic. Please go through the answer and the embedded links once again. The code block within my answer should work irrespective of os platforms.

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.