Question

I am writing a script in Python using Selenium that auto fills out a web form (a helpdesk ticketing system)

A factor in this is the body of the ticket does not have an element id that Selenium recognizes, so in order to type in the body I have to find the title element, press the tab key, then start typing in to the body.

Here is some code that writes a message into the body:

der = "/t this is the desc"
driver.find_element_by_id("title").send_keys(der)

The problem is, this code doesnt work for me. What I really need to do would look like this:

body = open(email.txt)
driver.find_element_by_id("title").send_keys("/t" + body)

So I want it to find the title element, press the tab key, then write what is stored in the body variable into the body of the ticket. the only issue is that syntax is bad.

I looked at SendKeys but that is windows only. I am using Fedora 16.

Any help/recommendations would be greatly appreciated.

Thanks!

Was it helpful?

Solution

You have a bug in your code. Change this:

body = open(email.txt)

to:

body = open("email.txt").read()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top