-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblogCommenter.py
More file actions
37 lines (31 loc) · 1.13 KB
/
blogCommenter.py
File metadata and controls
37 lines (31 loc) · 1.13 KB
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
37
#! python3
# goes to the copyblogger site and comments on 3 of their blogs (first 3)
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time
browser = webdriver.Firefox()
browser.implicitly_wait(20)
browser.get('https://copyblogger.com/')
time.sleep(2)
posts = browser.find_elements(By.CLASS_NAME, 'entry-title-link')
for i in range(len(posts)):
posts = browser.find_elements(By.CLASS_NAME, 'entry-title-link')
posts[i+2].click()
time.sleep(2)
page = browser.find_element(By.TAG_NAME, 'html')
page.send_keys(Keys.END)
commentSection = browser.find_element(By.ID, 'comment')
commentSection.send_keys('Lovely article')
time.sleep(2)
nameSection = browser.find_element(By.ID, 'author')
nameSection.send_keys('Random_Dude')
time.sleep(2)
EmailSection = browser.find_element(By.ID, 'email')
EmailSection.send_keys('RandomDude@gmail.com')
time.sleep(2)
submitButton = browser.find_element(By.NAME, 'submit')
submitButton.click()
browser.back()
browser.back()
browser.quit()