Automating gmail standard using selenium rc

4 views
Skip to first unread message

amadain

unread,
Jun 11, 2009, 10:34:25 AM6/11/09
to Google Test Automation Conference
Hi
I am trying to automate sending a mail through gmail standard version
and I am having a problem. The following code gets me to the send
message frame, populates all of the correct fields and even focuses on
the 'Send' button. The problem is I can get the code to click on the
send button.

def test_new(self):
sel = self.selenium
sel.open("/mail")
sel.refresh()
sel.wait_for_page_to_load("5000")
sel.delete_all_visible_cookies()
sel.type("Email", username)
sel.type("Passwd", password)
sel.click("signIn")
sel.wait_for_page_to_load("30000")
sel.select_frame("canvas_frame")
html=sel.get_html_source()
p=re.search(".*(<span.*?Compose Mail.*?/span>)", html)
if not p:
return
id=re.search("span id=\"(.*?)\"", p.group(1)).group(1)
sel.click(id)
time.sleep(5)
html=sel.get_html_source()
sel.type("name=to", user_email1)
sel.type("name=cc", user_email2)
sel.type("name=subject", "automated gmail message")
sel.type("name=body", "automated through selenium")
sendButton=re.search(".*(<div.*?id=\"(.*?)\".*?goog-imageless-
button goog-inline-block.*?<b>Send</b>)", html)
if not sendButton:
return
sel.focus(sendButton.group(2))
self.selenium.click(sendButton.group(2))

This does not work so I tried another approach. I tried sending the
ascii code for carriage return when the button was highlighted:

self.selenium.key_press(sendButton.group(2), "\13")

Other things I have tried and failed with:

sel.click("id='%s'" % sendButton.group(2))
sel.click("//div[@id='%s']/div/div/div/div/div[2]/b" %
sendButton.group(2))
sel.key_press_native(13)

At this stage I have run out of ideas. Can anyone enlighten me?

M

Ahmed Mubbashir Khan

unread,
Jun 11, 2009, 4:46:01 PM6/11/09
to lt...@googlegroups.com
Try Using
sel.clickAt("//div[@id=':vn']/div", "1,2");
or
sel.clickAt("//div[text()='Send']", "1,2");

Even I am trying to send this reply via these commands in SIDE.

Regards,
----------------------------------
Ahmed Mubbashir Khan
"I do not make Software, I make it better"
Reply all
Reply to author
Forward
0 new messages