1

Issue: I got "error" in line:

self.driver.find_element_by_id("email_create").send_keys("deen@gmail.com")

the driver put into website completly different email like "deenSOMEDIFFERENTWORDgmail.com" and i cannot solve why "@" does not work property. do you have any idea why it works like that?, its seems like memory issue but i am not sure

from selenium import webdriver from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By import time

class automationPractice():
    def __init__(self):
        self.driver=webdriver.Chrome()
    
    def createAccount(self):
        self.driver.get("http://automationpractice.com/index.php")
        self.driver.find_element_by_class_name("login").click()
        
        try:
            WebDriverWait(self.driver,10).until(EC.element_to_be_clickable((By.ID,"email_create")))
        except:
            print("error-email_create")
            self.driver.quit()
        
        self.driver.find_element_by_id("email_create").send_keys("deen@gmail.com")
        self.driver.find_element_by_id("SubmitCreate").click()

        try:
            WebDriverWait(self.driver,10).until(EC.element_to_be_clickable((By.ID,"id_gender1")))
        except:
            print("error-id_gender1")
            self.driver.quit()
        self.driver.find_element_by_id("id_gender1").click()

if __name__ == "__main__":
    test1= automationPractice()
    test1.createAccount()

    time.sleep(4)
Dawid_N
  • 13
  • 4
  • A couple questions: If you run this multiple times, does the value of 'SOMEDIFFERENTWORD' change? And can you give the actual text it changes to, instead of 'SOMEDIFFERENTWORD'? – Phil Oct 21 '20 at 19:34
  • What error are you getting? – Jortega Oct 21 '20 at 19:37
  • I get the right values with the same code. – Arundeep Chohan Oct 21 '20 at 19:58
  • words like "deen/ return wewgmail.com". in previous run I had different word so its seems like "@" put word from memory but its kind of weird.. – Dawid_N Oct 21 '20 at 20:30
  • someone else mentioned this, too... I think they said changing language settings fixed it. In his/her case the "@" symbol was sending clipboard data. – pcalkins Oct 21 '20 at 21:51
  • other post: https://stackoverflow.com/questions/64385485/selenium-sendkeys-with-chromedriver-uses-clipboard-content-instead-of-char – pcalkins Oct 21 '20 at 22:01
  • seems that a Croatian keyboard would send the equivalent of CTRL-V in certain circumstances... weirdness. – pcalkins Oct 21 '20 at 22:11
  • yea this is the same issue. In my case I just had to install another language to system (i add english) and this solved issue. But the issue its very interesting and i am very courious why this happened, that selenium put clipboard data against "@" – Dawid_N Oct 21 '20 at 22:15
  • 1
    I guess the Croatian keyboard uses right-alt-v for the "@" symbol. Somehow (and might be a bug at the OS level) this is translating to Ctrl-V and pasting. – pcalkins Oct 21 '20 at 22:49

1 Answers1

0

the '@' symbol is being treated as a special character you have to escape it to use the original symbol.

Try self.driver.find_element_by_id("email_create").send_keys("deen\@gmail.com")

mitchell
  • 298
  • 1
  • 11