0

I'm trying to automate a manual process using Python Selenium, where I have write a block of SQL codes within a textbox in a website on a daily basis.

We can input Texts using send_keys(). But I'm not sure How can we input a Block of SQL queries with a textbox using python selenium so that I can automate this process.

Basically We Input SQL queries in the textbox in our website on a daily basis and whatever queries are there within the textbox the website executes them and provides the result in dashboard. Basically the textbox acts as a Compiler for SQL queries.

Can anyone help me how to input a Block of SQL queries to a textbox in a website using python selenium as to automate this daily process.

Thanks, Sanjay.

2
  • driver.find_element_by_xpath().send_keys("select * from table");
    – Yash
    CommentedAug 29, 2020 at 4:26
  • What are your code trials? , Welcome to SO!! Please read minimal reproducible example and edit your post accordingly and follow the same in future post. Don't put the screenshot of code.
    – Dev
    CommentedAug 29, 2020 at 6:57

1 Answer 1

0

As per my understanding on your query, you are trying to enter a bunch of SQL commands line by line in the same text box, the send_keys is a good option but to enter the text without leaving the text box, you have to use Keys.chord(Keys.SHIFT, Keys.ENTER).

For example:

driver.find_element("locator","value").send_keys("select * from table, Keys.chord(Keys.SHIFT, Keys.ENTER), .....") 

Otherwise if different text boxes are to be used to enter different SQL commands, then send_keys("") is fine to work.

1

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.