Jason Owens Jason Owens - 9 months ago 79
Python Question

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()
assert "02 Nissan Xterra - $3000 (Matthews)" in driver.title
assert "No results found." not in driver.page_source
car = driver.find_element_by_link_text("mail.live.com").text
message = "Hi, my name is" + name + " and" + car

Answer Source

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

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