/username.py Secret
Created
July 9, 2017 11:09
Star
You must be signed in to star a gist
Useful to iterate through a single using def function with single arguments.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import time | |
import getpass | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
def Quora_bot(Username=None): | |
chromedriver = 'F:\All Folders\chromedriver\shit.exe' | |
#Uncomment this block if you don't want images to load(makes the procss a little bit faster) | |
''' | |
chromeOptions = webdriver.ChromeOptions() | |
prefs = {"profile.managed_default_content_settings.images":2} | |
chromeOptions.add_experimental_option("prefs",prefs) | |
browser = webdriver.Chrome(chromedriver, chrome_options=chromeOptions) | |
''' | |
browser = webdriver.Chrome(chromedriver) | |
browser.get("http://www.quora.com") # Quora home page | |
time.sleep(10) | |
# Logging into Quora | |
form = browser.find_element_by_class_name('regular_login') | |
email = form.find_element_by_name("email") | |
password = form.find_element_by_name("password") | |
button_element = browser.find_element_by_xpath("//*[@value='Login']") | |
email.send_keys(Username) | |
with open('newfile.txt') as u: | |
for line in u: | |
Quora_bot(Username=line) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment