Jason Owens
Jason Owens

Reputation: 543

Selenium reply button not working

Good evening. I'm working on an automated craigslist response program and I'm in need of someone to explain to me why when I get to click on the "reply", & the email clients come up, it doesn't click on them. I've tried every method and find by element combo, to no avail. I'm sure it's something that I'm overlooking in my code. thanks in advance

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
def Job():
    driver = webdriver.Chrome()
    driver.get("http://charlotte.craigslist.org/sad/5838008849.html")
    assert "02 Nissan Xterra - $3000 (Matthews)" in driver.title
    assert "No results found." not in driver.page_source
    #elem3.send_keys(Keys.RETURN)
    time.sleep(1)
    driver.find_element_by_class_name("reply_button").click()
    driver.find_element_by_class_name("reply-emails").click()
    car = driver.find_element_by_link_text("mail.live.com").text
    message = "Hi, my name is" + name + " and" + car
Job()

Upvotes: 1

Views: 280

Answers (1)

Andersson
Andersson

Reputation: 52685

You have to use another locators as you're trying to handle not clickable elements. Try following:

driver.find_element_by_id("replylink").click()
driver.find_element_by_xpath("//a[@class=\"reply-email gmail\"]").click()

Upvotes: 1

Related Questions