How to send keys at beginning of textbox using python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: How to send keys at beginning of textbox using python (/thread-10442.html) |
How to send keys at beginning of textbox using python - Prince_Bhatia - May-21-2018 hi, I have some text that i wish to enter via selenium into a webpage but my problem i want to insert them at beginning of the text as right now of there is already text into the text box it inserts my text at the bottom. data_reference = driver.find_element_by_xpath('//*[@id="editdetails_frm"]/table/tbody/tr[24]/td[3]/textarea'+"\n") data_reference.send_keys(str(ele[1])) data_reference1 = driver.find_element_by_xpath('//*[@id="edit_detail[22]"]') data_reference1.click()above is snippet of my code. Help is appreciated.Please dont mind the indentations i am trying to level them RE: How to send keys at beginning of textbox using python - mlieqo - May-21-2018 Hello, so if I understand your problem correctly, you want to keep the text in the textarea but enter some string at the beginning: data_reference = driver.find_element_by_xpath('//*[@id="editdetails_frm"]/table/tbody/tr[24]/td[3]/textarea'+"\n") text_in_textarea = data_reference.text data_reference.clear() data_reference.send_keys(str(ele[1]) + text_in_textarea) data_reference1 = driver.find_element_by_xpath('//*[@id="edit_detail[22]"]') data_reference1.click()I think you just need to save the text that's already in, clear the textarea and enter your string together with the text that was there before. RE: How to send keys at beginning of textbox using python - Prince_Bhatia - May-21-2018 Hey Thanks a lot, it was almost slipped out of my mind. Thanks a lot again |