Skip to content

Instantly share code, notes, and snippets.

@rahim42324
Last active September 22, 2023 21:51
Show Gist options
  • Select an option

  • Save rahim42324/d11dbe1790b59960cbb2b6b20fa243e8 to your computer and use it in GitHub Desktop.

Select an option

Save rahim42324/d11dbe1790b59960cbb2b6b20fa243e8 to your computer and use it in GitHub Desktop.
from selenium import webdriver
from selenium.webdriver import ActionChains
import time
driver=webdriver.Chrome("chromedriver.exe")
driver.get("https://twitter.com/login")
time.sleep(3)
driver.find_element_by_xpath("//input[@name='session[username_or_email]']").sendkeys("type username")
driver.find_element_by_xpath("//input[@name='session[password]']").sendkeys("type password")
driver.find_element_by_xpath("//div[@data-testid='LoginForm_Login_Button']").click()
time.sleep(3)
driver.find_element_by_class_name('DraftEditor-root').click()
element=driver.find_element_by_class_name('public-DraftEditorPlaceholder-root')
ActionChains(driver).move_to_element(element).send_keys("hello world").perform()
driver.find_element_by_xpath("//*[context='text(Tweet)']").click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment