-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTwitterPost.py
More file actions
37 lines (22 loc) · 811 Bytes
/
Copy pathTwitterPost.py
File metadata and controls
37 lines (22 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from selenium import webdriver
## Variaveis
MY_USER_NAME = 'seu usuario'
MY_PASSWORD = 'sua senha aqui'
## Acessando o Twitter
driver = webdriver.Chrome()
driver.get('http://twitter.com/login')
## Preenchendo o USUARIO
name = driver.find_element_by_xpath("//input[@class='js-username-field email-input js-initial-focus']")
name.send_keys(MY_USER_NAME)
## Preenchendo a SENHA
senha = driver.find_element_by_xpath("//input[@class='js-password-field']")
senha.send_keys(MY_PASSWORD)
name.submit()
## Acessando pag de POST
driver.get('https://twitter.com/intent/tweet?text=')
## Escrevendo a Mensagem
MY_MSG = 'POST PYTHON'
text = driver.find_element_by_xpath("//textarea[@id='status']")
text.send_keys(MY_MSG)
## Clicando em TWEETAR
driver.find_element_by_xpath("//input[@value='Tweetar']").click()