CarlThePerson
CarlThePerson

Reputation: 518

Comment on tweet using selenium python webdriver

I'm having trouble replying to a tweet link using selenium and python. I tried find_element_by: id, xpath, class_name and more and not having any luck. I just cantt find the element. Is Twitter making this impossible?

Upvotes: 0

Views: 1715

Answers (1)

CarlThePerson
CarlThePerson

Reputation: 518

I got it to work:

driver.get(link)
number = link.split("/")
number = number[len(number) - 1]
driver.find_element_by_id("tweet-box-reply-to-" + number).click()
driver.find_element_by_id("tweet-box-reply-to-" + number).click()
driver.find_element_by_id("tweet-box-reply-to-" + number).send_keys(comment)
driver.find_element_by_id("tweet-box-reply-to-" + number).send_keys(Keys.CONTROL + "\n")

Upvotes: 3

Related Questions