In Selenium I want to input a teststring "hello'world"
, but the webpage's textbox becomes "helloworld"
. As if the apostrophe doesn't exist. Replacing "'"
by chr(39)
or splitsing the string doesn't do the job either.
- My part of the code: (using Chrome webdriver in python)
driver = webdriver.Chrome()
driver.get("https://google.com")
text = "hello'world"
textbox = driver.find_element_by_xpath('//*
[@id="tsf"]/div[2]/div[1]/div[1]/div/div[2]/input')
for i in text:
textbox.send_keys(i)
sleep(0.1)