def run(self):
        browser = Browser('chrome',
                          executable_path=EXECUTABLE_PATH,
                          service_args=PROXIES)
        # browser = Browser('phantomjs', service_args=PROXIES, user_agent=USER_AGENT)
        with browser:
            page = 1
            browser.visit(URL)
            browser.fill("q", KEYWORD)
            browser.find_by_name("btnG").click()
            time.sleep(5)

            while True:
                time.sleep(10)
                logging.info("Page " + str(page))
                for link in browser.find_by_css("h3.r"):
                    if "applicationname" in link.find_by_css(
                            "a").first["href"].lower():
                        self.url_queue.put(link.find_by_css("a").first["href"])
                page += 1
                if browser.find_by_css("#pnnext"):
                    browser.find_by_css("#pnnext").click()
                else:
                    break
            self.url_queue.put(None)
Exemple #2
0
def login(username, password):
    browser = Browser('chrome')
    browser.visit('https://www.reg.uci.edu/cgi-bin/webreg-redirect.sh')
    browser.fill('ucinetid', username)
    browser.fill('password', password)
    browser.find_by_name('login_button').click()
    return browser
Exemple #3
0
class UserUtils(object):
        def __init__(self):
                self.config = config.read_config()
		self.account = self.config['account']
                self.idp_server = self.config['nodes']['idp_node']
		
		# Abort test if esgf-web-fe is not reachable
		r = requests.get("https://{0}/esgf-web-fe".format(self.idp_server), verify=False, timeout=1)
                assert r.status_code == 200

		self.browser = Browser('firefox')

		# Mapping user data to fit to web-fe user creation form 
                self.elements = {'firstName' : self.account['firstname'],
                                 'lastName'  : self.account['lastname'],
                                 'email'     : self.account['email'],
                                 'userName'  : self.account['username'],
                                 'password1' : self.account['password'],
                                 'password2' : self.account['password']}


	def check_user_exists(self):
		URL = "https://{0}/esgf-web-fe/login".format(self.idp_server)
		OpenID = "https://{0}/esgf-idp/openid/{1}".format(self.idp_server, self.account['username'])

		# Try to log in
		self.browser.visit(URL)
		self.browser.find_by_id('openid_identifier').fill(OpenID)
		self.browser.find_by_value('Login').click()

		# User does not exist if unable to resolve OpenID
		if(self.browser.is_text_present("Error: unable to resolve OpenID identifier")):
			self.user_exists = False
		else:
			self.user_exists = True
		
        def create_user(self):
		URL = "https://{0}/esgf-web-fe/createAccount".format(self.idp_server)
        	self.browser.visit(URL)
	
		# Filling the form
		for element_name in self.elements:
			self.browser.find_by_name(element_name).fill(self.elements[element_name])

      		self.browser.find_by_value('Submit').click()

		# Parsing response
		self.response = []		
		if (self.browser.is_text_present("SUCCESS") == True):
			self.response.append("SUCCESS")
		else:
			self.response.append("FAILURE")
			selection = self.browser.find_by_tag('span')
			for sel in selection:
				if sel.has_class('myerror'):
					self.response.append(sel.value)


        def exit_browser(self):
		self.browser.quit()
Exemple #4
0
def buyprd(u):
	browser = Browser('firefox')
	url = u
	browser.visit(url)
	# 10|10.5
	browser.find_option_by_text(selectOption).first.click()
	browser.find_by_name('commit').click()
	if browser.is_text_present('item'):
		print("Added to Cart")
	else:
        	print("Error")
		return
	print "checking out"
	browser.visit(checkoutUrl)
	print "Filling Out Billing Info"
	browser.fill("order[billing_name]", namefield)
	browser.fill("order[email]", emailfield)
	browser.fill("order[tel]", phonefield)

	print "Filling Out Address"
	browser.fill("order[billing_address]", addressfield)
	browser.fill("order[billing_zip]", zipfield)
	browser.select("order[billing_state]", statefield)
	print "Filling Out Credit Card Info"

	browser.select("credit_card[type]", cctypefield)
	browser.fill("credit_card[number]", ccnumfield)
	browser.select("credit_card[month]", ccmonthfield)
	browser.select("credit_card[year]", ccyearfield)
	browser.fill("credit_card[verification_value]", cccvcfield)
	browser.find_by_css('.terms').click()
	print "Submitting Info"
	browser.find_by_name('commit').click()
	sys.exit(0)
Exemple #5
0
def twitterMagic():
	print "Twitter Magic Time!!!"
	browser = Browser('firefox')
	browser.visit('https://twitter.com/signup')
	nameslist = grabNames()
	emaillist = grabEmails()
	passlist = grabPasses()
	userlist = grabUsers()
	# for each name in the list, fill the form in with data from the text files
	# note to self - you have to set variables to loop through and pick the next name after the first is signed up
	# STEPS!!!
	# fill name field
	# fill email
	# fill password
	# uncheck check mark
	# click signup button
	# (NEXT PAGE)
	# fill username?
	# profit
	x = 0
	for x in nameslist:
		browser.fill(nameslist[x], 'full-name')
		browser.fill(emaillist[x], 'email')
		browser.fill(passlist[x], 'password')
		browser.fill(userlist[x], 'username')
		browser.uncheck('checkbox')
		browser.find_by_name('Sign Up').first.click()
		browser.back()
		x = x + 1
Exemple #6
0
def start():
    x = input('[+] Post URL: ')
    browser = Browser('chrome')
    # Visit URL
    url = "https://igsub.me"
    url2 = "https://igsub.me/postViews"
    browser.visit(url)
    browser.visit(url2)

    #buttonServer = browser.find_by_value('Get Page (THIS SERVER)').click()

    link = browser.find_by_name('formPostLink').click()
    browser.fill('formPostLink', x)
    # Find and click the 'search' button
    browser.find_by_id('firstFormElementSendButton').click()
    time.sleep(4)

    browser.find_by_name('formPostActionLimit').click()

    count = browser.find_by_value('3000').click()

    send = browser.find_by_id('secondFormElementSendButton').click()

    # Interact with elements
    #button.click()
    while browser.is_text_present('PROCESSING...'):
        print("PROCESSING...")
    else:
        print("Done")
        start()
def checkin(confirmation, first, last, email, run_time):
    """Check in to a flight.

    Arguments:
    confirmation -- your confirmation number
    first -- your first name
    last -- your last name
    email -- email address to send confirmation
    run_time -- the time you need to check in
    """
    browser = Browser('zope.testbrowser', ignore_robots=True)
    browser.visit('https://www.southwest.com/flight/retrieveCheckinDoc.html')
    browser.fill('confirmationNumber', confirmation)
    browser.fill('firstName', first)
    browser.fill('lastName', last)

    delta = run_time - datetime.now()
    time.sleep(delta.total_seconds())

    submit = browser.find_by_name('submitButton')
    submit.click()
    if browser.find_by_id('errors_props_wrapper') != []:
        browser.quit()
        raise RuntimeError("Info is incorrect or you checked in too early")

    check_in = browser.find_by_name('printDocuments')
    check_in.click()

    email = browser.find_by_id('optionEmail')
    email.click()
    browser.fill('emailAddress', email)
    cont = browser.find_by_name('book_now')
    cont.click()

    browser.quit()
Exemple #8
0
def qd():
##    browser = Browser('firefox'
##        , profile='D:\UsersDocuments\FFmissions')
    browser = Browser('chrome')
    browser.visit(juchaozhi)
    time.sleep(1)
    browser.find_by_name('username').fill(username)
    browser.find_by_name('password').fill(password)
    browser.find_by_name('button').click()
    time.sleep(1)
    if browser.is_text_present(username, wait_time=1):
        print ('login success!')
        logging.info('login success!')
        browser.visit('http://best.pconline.com.cn/qiandao.html')
        time.sleep(1)
##        添加今天是否有签到的判断,主要判断口id="JBar",或者判断CSS中的元素,如.signStatus,.isgnUps
        if browser.find_by_css('.signStatus').visible:
            print ('you had signed!')
            logging.info('you had signed!')
            browser.quit()
        else:
            browser.find_by_xpath('//*[@id="JSignBox"]/a').click()
            time.sleep(1)
            print ('mission success!')
            logging.info('mission success!')
            browser.quit()
    else:
        print ('login fail!!!')
        logging.info('login fail!!!')
Exemple #9
0
def twitterMagic():
    print "Twitter Magic Time!!!"
    browser = Browser("firefox")
    browser.visit("https://twitter.com/signup")
    nameslist = grabNames()
    emaillist = grabEmails()
    passlist = grabPasses()
    userlist = grabUsers()
    # for each name in the list, fill the form in with data from the text files
    # note to self - you have to set variables to loop through and pick the next name after the first is signed up
    # STEPS!!!
    # fill name field
    # fill email
    # fill password
    # uncheck check mark
    # click signup button
    # (NEXT PAGE)
    # fill username?
    # profit
    x = 0
    for x in nameslist:
        browser.fill(nameslist[x], "full-name")
        browser.fill(emaillist[x], "email")
        browser.fill(passlist[x], "password")
        browser.fill(userlist[x], "username")
        browser.uncheck("checkbox")
        browser.find_by_name("Sign Up").first.click()
        browser.back()
        x = x + 1
Exemple #10
0
def buyprd(u):
    browser = Browser('firefox')
    url = u
    browser.visit(url)
    # 10|10.5
    browser.find_option_by_text(selectOption).first.click()
    browser.find_by_name('commit').click()
    if browser.is_text_present('item'):
        print("Added to Cart")
    else:
        print("Error")
        return
    print("checking out")
    browser.visit(checkoutUrl)
    print("Filling Out Billing Info")
    browser.fill("order[billing_name]", namefield)
    browser.fill("order[email]", emailfield)
    browser.fill("order[tel]", phonefield)

    print("Filling Out Address")
    browser.fill("order[billing_address]", addressfield)
    browser.fill("order[billing_zip]", zipfield)
    browser.select("order[billing_state]", statefield)
    browser.select("order[billing_country], country)
    print("Filling Out Credit Card Info")

    browser.select("credit_card[type]", cctypefield)
    browser.fill("credit_card[number]", ccnumfield)
    browser.select("credit_card[month]", ccmonthfield)
    browser.select("credit_card[year]", ccyearfield)
    browser.fill("credit_card[verification_value]", cccvcfield)
    browser.find_by_css('.terms').click()
    print("Submitting Info")
    browser.find_by_name('commit').click()
    sys.exit(0)
Exemple #11
0
def post_message(create_msg_url, category, title, message, send):
    """
    Create a new U-Cursos forum's message (a.k.a. thread).
    :param category: Specific for community message category
    :param create_msg_url: URL of new message view (syntax is https://www.u-cursos.cl/<institution>/<year>/<semester>/<community>/<section>/foro/mensaje)
    :param title: Message Title
    :param message: Message content
    :param send: Boolean flag to send the message to the forum
    :return:
    """
    # config
    browser = Browser('chrome')
    browser.visit(create_msg_url)

    # log in
    browser.fill(USERNAME_FIELD_NAME, private_credentials.username)
    browser.fill(PASSWORD_FIELD_NAME, private_credentials.password)
    browser.find_by_value(LOG_IN_BUTTON_VALUE).click()

    # build up message
    # choose category
    browser.find_by_id(CATEGORY_CHOSER_ID).first.click()
    browser.find_by_css(CATEGORY_CHOSER_TEXT_INPUT_CSS_CLASS).first.fill(
        "{}\n".format(category))

    # write title
    browser.find_by_name(TITLE_FIELD_NAME).fill(title)

    # write message
    browser.find_by_name(MESSAGE_INPUT_NAME).fill(message)

    # send message (CAUTION)
    if send:
        browser.find_by_value(SEND_BUTTON_VALUE).click()
Exemple #12
0
def loginweibo():
    web_firefox = Browser('chrome')
    web_firefox.visit('http://weibo.com/login.php')
    # button = browser.find_by_xpath("//input[@value='Sign In']")
    if web_firefox.find_by_name('username'):
        print 'uname'
        # web_firefox.find_by_name('username').click()
        # 这个地方用by_name能找到,但是模拟点击时有问题,改成by_csshttp://www.djhull.com/python/training-python-5.html
        web_firefox.find_by_css("input[node-type=\"username\"]").fill('xxx')
    time.sleep(random.randint(3, 10))

    if web_firefox.find_by_name('password'):
        print 'passwd'
        web_firefox.find_by_css("input[node-type=\"password\"]").fill('xxx')

    time.sleep(random.randint(3, 15))
    # print web_firefox.find_by_css(".loginbox .W_login_form .login_btn a ")[0].click()
    print web_firefox.find_by_css("span[node-type=\"submitStates\"]").click()

    time.sleep(random.randint(3, 10))
    print web_firefox.find_by_css(".input .W_input").fill(
        u'我说不让你用微博测试,你非用,得了吧。。。。 封ip了吧')

    time.sleep(random.randint(3, 10))
    print web_firefox.find_by_css("a[node-type=\"submit\"]").click()
Exemple #13
0
def weibo():
    web_firefox = Browser('chrome')
    web_firefox.visit('http://weibo.com/login.php')

    if web_firefox.find_by_name('username'):
        print 'uname'
        # web_firefox.find_by_name('username').click()
        # 这个地方用by_name能找到,但是模拟点击时有问题,改成by_css
        web_firefox.find_by_css("input[node-type=\"username\"]").fill(
            '*****@*****.**')
    time.sleep(random.randint(3, 10))

    if web_firefox.find_by_name('password'):
        print 'passwd'
        web_firefox.find_by_css("input[node-type=\"password\"]").fill('******')

    time.sleep(random.randint(3, 15))
    print web_firefox.find_by_css(
        ".loginbox .W_login_form .login_btn div a ")[0].click()

    time.sleep(random.randint(3, 10))
    print web_firefox.find_by_css(".input .W_input").fill(
        u'我说不让你用微博测试,你非用,得了吧。。。。 封ip了吧')

    time.sleep(random.randint(3, 10))
    print web_firefox.find_by_css("a[node-type=\"submit\"]").click()
Exemple #14
0
def _register(domain='gmail.com'):
	browser = Browser()
	inn=invents()
	inn.generate()
	
	browser.visit('https://bitcointalk.org/index.php?action=register')
	browser.find_by_name('user').last.fill(inn.MailAddress)
	
	browser.fill('email', inn.MailAddress+'@'+domain)
	browser.fill('passwrd1', inn.Passwd)
	browser.fill('passwrd2', inn.Passwd)
	
	url=browser.find_by_id('verificiation_image').first['src']
	url=url.replace('mycode=2;','mycode=4;')
	#print url
	
	PHPSESSID=browser.cookies['PHPSESSID']
	
	cook='PHPSESSID=%s' % PHPSESSID
	cap=recognize_captcha(url, cook=cook)
	#print cap
	browser.fill('visual_verification_code', cap)
	browser.find_by_name('regSubmit').first.click()
	
	if browser.title.find('Error')>=0:
		print 'Eror= %s' % browser.title
	else:
		print "('%s', '%s')" % (inn.MailAddress, inn.Passwd)
		time.sleep(30)
	
	browser.quit()
def begin_login(bilkent_id, password, mail, mail_pass):
    browser = Browser()
    browser.visit('https://stars.bilkent.edu.tr/srs/')

    input_elements = browser.find_by_tag('input')

    pass_field = input_elements[2]
    pass_id = pass_field['id']
    browser.execute_script(
        "var y = document.getElementById(\"LoginForm_password\").type = \"password\""
    )

    browser.fill('LoginForm[username]', bilkent_id)

    browser.type(pass_field['name'], password)
    browser.find_by_name('yt0').click()

    sleep(1)

    raw_email = get_mails(mail, mail_pass)
    verification_code = get_verification_code(raw_email.decode("utf-8"))

    browser.fill("EmailVerifyForm[verifyCode]", verification_code)
    browser.find_by_name('yt0').click()

    sleep(1)
Exemple #16
0
class UserUtils(object):
        def __init__(self):
                self.config = config.read_config()
		self.account = self.config['account']
                self.idp_server = self.config['nodes']['idp_node']
		
		# Abort test if esgf-web-fe is not reachable
		r = requests.get("https://{0}/user/add".format(self.idp_server), verify=False, timeout=1)
                assert r.status_code == 200

		self.browser = Browser('firefox')

		# Mapping user data to fit to web-fe user creation form 
                self.elements = {'first_name' : self.account['firstname'],
                                 'last_name'  : self.account['lastname'],
                                 'email'     : self.account['email'],
                                 'username'  : self.account['username'],
                                 'password' : self.account['password'],
                                 'confirm_password' : self.account['password'],
				 'institution' : self.account['institution'],
				 'city' : self.account['city'],
				 'country' : self.account['country']}


	def check_user_exists(self):
		URL = "https://{0}/login".format(self.idp_server)
		OpenID = "https://{0}/esgf-idp/openid/{1}".format(self.idp_server, self.account['username'])

		# Try to log in
		self.browser.visit(URL)
		self.browser.find_by_id('openid_identifier').fill(OpenID)
		self.browser.find_by_value('Login').click()

		# User does not exist if unable to resolve OpenID
		if(self.browser.is_text_present("OpenID Discovery Error: unrecognized by the Identity Provider.")):
			self.user_exists = False
		else:
			self.user_exists = True
		
        def create_user(self):
		URL = "https://{0}/user/add".format(self.idp_server)
        	self.browser.visit(URL)
	
		# Filling the form
		for element_name in self.elements:
			self.browser.find_by_name(element_name).fill(self.elements[element_name])

      		self.browser.find_by_value('Submit').click()

		# Parsing response
		self.response = []		
		if (self.browser.is_text_present("Thank you for creating an account. You can now login.") == True):
			self.response.append("SUCCESS")
		else:
			self.response.append("FAILURE")


        def exit_browser(self):
		self.browser.quit()
Exemple #17
0
def netflix(sentence, args):
    netflix_config = config.load_config("netflix")
    if netflix_config:
        username = netflix_config['username']
        password = keyring.get_password("netflix", username)
        profile_name = netflix_config["profile_name"]
        if username and password:
            #TODO: change this to zope.testbrowser once it's working in the frontend
            chrome_path = config.load_config("chrome_path")
            executable_path = {'executable_path': chrome_path}
            browser = Browser("Chrome")
            browser.visit("https:///netflix.com/Login")
            email_field = browser.find_by_name("email")
            password_field = browser.find_by_name("password")
            sign_in_xpath = '//*[@id="appMountPoint"]/div/div[2]/div/form[1]/button'
            sign_in_button = browser.find_by_xpath(sign_in_xpath)
            email_field.fill(username)
            password_field.fill(password)
            sign_in_button.click()
            if browser.is_text_present(profile_name):
                profile_button = browser.find_by_text(profile_name)
                profile_button.click()
                #Use ent code to find out if there's a named work of art that was detected
                #search_tab_xpath = '//*[@id="hdPinTarget"]/div/div[1]/div/button'
                #search_tab_xpath = '//*[@id="hdPinTarget"]/div/div[1]/div/button/span[1]'
                search_tab_xpath = '//*[@id="hdPinTarget"]/div/div[1]/div/button'
                search_tab = browser.find_by_xpath(search_tab_xpath)
                search_tab.click()
                if "netflix" in sentence:
                    if "netflix play "in sentence:
                        show = sentence.split("netflix play ")[1]
                    else:
                        show = sentence.split("netflix ")[1]
                    #search_field = browser.find_by_text("Titles, people, genres")[0]
                    search_field_xpath = '//*[@id="hdPinTarget"]/div/div[1]/div/div/input'
                    search_field = browser.find_by_xpath(search_field_xpath)
                    search_field.fill(show)
                    show_card_xpath = '//*[@id="title-card-undefined-0"]'
                    show_card = browser.find_by_xpath(show_card_xpath)
                    show_card.click()
                    play_icon_xpath = '//*[@id="title-card-undefined-0"]/div[2]/a/div/div'
                    play_icon = browser.find_by_xpath(play_icon_xpath)
                    play_icon.click()
                    play_button_xpath = '//*[@id="70279852"]/div[2]/a/div/div'
                    play_button = browser.find_by_xpath(play_button_xpath)
                    play_button.click()
                    #chromecast_button_xpath = '//*[@id="netflix-player"]/div[4]/section[2]/div[7]/div[2]/button'
                    #chromecast_button = browser.find_by_xpath(chromecast_button_xpath)
                    #chromecast_button.click()
                    return "Done"
            else:
                return "Profile {0} could not be found on the netflix page".format(str(profile_name))
        else:
            return "Netflix username and password could not be retrieved from config and keyring"
    else:
        return "Netflix config not found"
Exemple #18
0
 def __enter__(self):
     browser = Browser()
     url = BASE_URL + 'login.jsp'
     browser.visit(url)
     with browser.get_iframe('base'):
         browser.fill('loginfoodcoopid', FOOD_COOP_ID)
         browser.fill('loginnickname', LOGIN_NAME)
         browser.fill('loginpassword', PASSWORD)
         browser.find_by_name('').first.click()
         return browser
 def __enter__(self):
     browser = Browser()
     url = BASE_URL + 'login.jsp'
     browser.visit(url)
     with browser.get_iframe('base'):
         browser.fill('loginfoodcoopid', FOOD_COOP_ID)
         browser.fill('loginnickname', LOGIN_NAME)
         browser.fill('loginpassword', PASSWORD)
         browser.find_by_name('').first.click()
         return browser
 def open_download_tab(self, track_list):
     for track in track_list:
         try:
             browser = Browser('chrome')
             browser.visit('http://google.com')
             print track
             browser.fill('q', track[0] + ' ' + track[1] + ' download free')
             browser.find_by_name('btnG').first.click()
         except Exception:
             pass
def login():
    from splinter import Browser

    login_name = "urep_pp"
    password = "******"
    url = "http://home.51cto.com/index?reback=http://dgd2010.blog.51cto.com/"
    browser = Browser('chrome')
    browser.visit(url)
    browser.find_by_id('loginform-username').fill(login_name)
    browser.find_by_id('loginform-password').fill(password)
    browser.find_by_name('login-button').click()
Exemple #22
0
    def auth_code(self):
        # create a new instance of chrome driver
        browser = Browser('chrome', **executable_path, headless=False)

        # build the url
        built_url = requests.Request(method, login_url,
                                     params=login_payload).prepare()
        built_url = built_url.url

        # go to our URL
        browser.visit(built_url)

        # fill out element on the form
        browser.find_by_id("username0").first.fill(username)
        browser.find_by_id("password").first.fill(password)
        browser.find_by_id('accept').first.click()

        # Move to security questions
        browser.find_by_tag("details").first.click()
        browser.find_by_name('init_secretquestion').first.click()

        # Find the question on the page
        question = browser.find_by_tag("main").find_by_tag(
            "div")[1].find_by_tag("p")[1].value.replace('Question: ', '')
        # Answer the question
        browser.find_by_id("secretquestion0").first.fill(sec_quest[question])

        # submit
        browser.find_by_id('accept').first.click()

        # yes trust this device
        browser.find_by_id('stepup_trustthisdevice0').find_by_tag(
            'div')[0].find_by_tag('label').first.click()
        # click save
        browser.find_by_id('accept').first.click()

        # submit again
        browser.find_by_id('accept').first.click()

        # give it a second to load
        time.sleep(1)

        # grab new url and parse
        new_url = browser.url
        code = urllib.parse.unquote(new_url.split('code=')[1])

        # close the browser
        browser.quit()

        return code
Exemple #23
0
def main2():
    from splinter import Browser

    browser = Browser('chrome')
    browser.visit('http://google.com')
    browser.fill('q', 'splinter - python acceptance testing for web applications')
    browser.find_by_name('btnG').click()

    if browser.is_text_present('splinter.readthedocs.io'):
        print "Yes, the official website was found!"
    else:
        print "No, it wasn't found... We need to improve our SEO techniques"

    browser.quit()
Exemple #24
0
def _navigate():
	browser = Browser()
	browser.visit('http://greekbill.com')

	#sign in
	browser.fill('txtUID', 'RemovedForGithub')
	browser.fill('txtPwd', 'RemovedForGiyhub')
	browser.find_by_name('imageField').first.click()

	#switch to admin account
	#browser.find_by_xpath("//select/option[@value='R32486,C34351']").click()

	#Charge Members
	browser.visit('https://www.greekbill.com/GBWEB/AddCharges.aspx')
	return browser
Exemple #25
0
def main():
    print("===== Run Starting =====")
    browser = Browser('firefox', headless=True)
    browser.visit('http://' + rg_ip + '/cgi-bin/nattable.ha')
    if browser.is_text_present('Device Access Code'):
        print("Logging in...")
        browser.fill('password', rg_password)
        browser.find_by_name('Continue').click()
        sessions_check(browser)
    elif browser.is_text_present('Total sessions in use'):
        print("Already logged in...")
        sessions_check(browser)
    else:
        print("Something went wrong and this script is unable to continue!")
    #s.enter(60 * check_min, 1, main, (sc,))
    browser.quit()
    print("===== Run Completed =====")
	def __authorize(self):
		b = Browser('chrome')
		b.visit("http://box-token-generator.herokuapp.com/")

		if b.find_link_by_href('set_client_credentials'):
			b.visit('http://box-token-generator.herokuapp.com/set_client_credentials')
			time.sleep(2)
		
			b.find_by_id('login').first.fill('*****@*****.**')
			b.find_by_id('password').first.fill('dharit1250')
			b.find_by_name('login_submit').first.click()

			b.find_by_id('consent_accept_button').first.click()
	
		code = b.find_by_tag('h4')[1].text
		self.client = box.BoxClient(code)
		b.quit()
	def __scrape(self, landing_page):
		browser = Browser('chrome', executable_path='C:\Python27\Lib\site-packages\chromedriver_win32\chromedriver.exe', service_args=PROXIES)
		# browser = Browser('phantomjs', service_args=PROXIES, user_agent='Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20130401 Firefox/21.0')
		with browser:
			template1 = True
			browser.visit(landing_page)
			time.sleep(2)

			nav = [x for x in browser.find_by_css('a.nav') if (x.text == 'Jobs by Location' or x.text == 'By Location')]
			if len(nav) > 0:
				nav[0].click()
			else:
				template1 = False
			link = browser.url
			state_index = 1
			city_index = 1

			while True:
				browser.visit(link)
				if not template1:
					nav = browser.find_by_css('#tabHeader')
					nav = nav.find_by_css('a')
					nav[1].click()
				states = browser.find_by_name('search.stateList.value')
				state_list = states.find_by_tag('option')
				print state_list[state_index].text
				state_list[state_index].click()
				if state_list[state_index].text != 'choose one...':
					element = 'cityList_' + state_list[state_index].text
					cities = browser.find_by_id(element)
					city_list = cities.find_by_tag('option')
					city_list[city_index].click()
					if city_list[city_index].text != 'choose one...':
						print city_list[city_index].text, state_list[state_index].text
						browser.find_by_id('cityStateSearch').click()
						links = None
						try:
							links = browser.find_by_css('a.withBubble')
						except:
							pass

						if len(links) > 0:
							for i in links:
								b = Browser('chrome', executable_path='C:\Python27\Lib\site-packages\chromedriver_win32\chromedriver.exe', service_args=PROXIES)
								# b = Browser('phantomjs', service_args=PROXIES, user_agent='Mozilla/5.0 (Windows NT 6.1; rv:21.0) Gecko/20130401 Firefox/21.0')
								with b:
									b.visit(i['href'])
									self.__navigate_pages(b)
						else:
							self.__navigate_pages(browser)
					city_index += 1
					if city_index == len(city_list):
						city_index = 0
						state_index += 1
						if state_index == len(state_list):
							break
				else:
					state_index += 1
def log_in_doban(Name='', PassWrod=''):
    if Name and PassWrod:
        bs = Browser('chrome')
        bs.visit(url='http://www.douban.com/accounts/login?source=main')
        if bs.is_element_present_by_id(id='email'):
            bs.find_by_id(id='email').fill(Name)
            bs.find_by_id(id='password').fill(PassWrod)
            if bs.is_element_present_by_id(id='captcha_field'):
                # bs.find_by_id('captcha_field').fill(code_img)
                while True:
                    val = bs.find_by_id(id='captcha_field').first.value
                    if val and len(val) > 0:
                        bs.find_by_id('captcha_field').fill(val)
                        break
                    pass
                pass
            bs.find_by_name('login').click()
            print(' login in')
def getRoutes(start, end):
    browser = Browser(driver_name="firefox")
    browser.visit("https://www.hopstop.com/search?xfr=cityscape")
    print(browser.url)
    browser.fill("address1", str(start))
    browser.fill("address2", str(end))
    browser.find_by_name("get_dirs").click()
    print(browser.url)
    if browser.is_text_present("Did you mean?"):
        browser.click_link_by_href("#")
        if browser.is_text_present("Did you mean?"):
            browser.click_link_by_href("#")
    browser.click_link_by_href("#")
    links = browser.find_link_by_partial_href("/station?stid")
    results = []
    for link in links:
        results.append(link.value)
    return results
def getRoutes(start, end):
    browser = Browser(driver_name="firefox")
    browser.visit('https://www.hopstop.com/search?xfr=cityscape')
    print(browser.url)
    browser.fill('address1', str(start))
    browser.fill('address2', str(end))
    browser.find_by_name('get_dirs').click()
    print(browser.url)
    if browser.is_text_present('Did you mean?'):
        browser.click_link_by_href("#")
        if browser.is_text_present('Did you mean?'):
            browser.click_link_by_href("#")
    browser.click_link_by_href("#")
    links = browser.find_link_by_partial_href("/station?stid")
    results = []
    for link in links:
        results.append(link.value)
    return results
def buy_product(product, store, buyer):
	chrome_options = webdriver.ChromeOptions()
	prefs = {"profile.managed_default_content_settings.images":2}
	chrome_options.add_argument('--disable-extensions')
	chrome_options.add_experimental_option("prefs",prefs)
	#chrome_options.Proxy = null
	#browser = Browser('chrome')
	browser = Browser('chrome', chrome_options)
	#browser.driver.set_window_size(1234, 987)
	#browser = webdriver.Chrome()
	#browser = webdriver.Chrome("/usr/local/bin/chromedriver")
	browser.visit(product.link)
	#print("finding size")

	foundsize = False
	for size in product.sizes:
		#print("looking for size: {}".format(size))
		size_button = browser.find_by_text(size)
		if size_button:
			foundsize = True
			#print("found size: {}".format(size))
			size_button.click()
			break

	if not foundsize:
		if product.any_size:
			print("\tCould not find desired size, but getting available size...")
		else:
			return 0
	try:
		add_to_cart = browser.find_by_name('commit')
		add_to_cart.click()
	except (AttributeError):
		print("Product seems to be sold out")
		return 0

	time.sleep(0.1)
	browser.visit(store.checkout_url)
	fill_billing_info(browser, buyer)
	fill_card_info(browser, buyer)

	browser.find_by_css('.terms').click()
	browser.find_by_name('commit').click()
	return 1
Exemple #32
0
def buyprd(prdurl):
    browser = Browser('firefox')
    browser.visit(prdurl)
    time.sleep(.5)
    print(browser.title)
    browser.find_option_by_text(selectOption).first.click()
    browser.find_by_name('commit').click()
    if browser.is_text_present('item'):
        print("Added to Cart")
    else:
        print("Error")
        return

    time.sleep(2)
    print("checking out")
    browser.visit(checkoutUrl)
    time.sleep(.5)
    print("Filling Out Billing Info")
    browser.fill("order[billing_name]", namefield)
    browser.fill("order[email]", emailfield)
    browser.fill("order[tel]", phonefield)

    print("Filling Out Address")
    browser.fill("order[billing_address]", addressfield)
    browser.fill("order[billing_zip]", zipfield)
    browser.select("order[billing_state]", statefield)
    print("Filling Out Credit Card Info")

    browser.select("credit_card[type]", cctypefield)
    browser.fill("credit_card[number]", ccnumfield)
    browser.select("credit_card[month]", ccmonthfield)
    browser.select("credit_card[year]", ccyearfield)
    browser.fill("credit_card[verification_value]", cccvcfield)

    browser.find_by_css('.terms').click()
    time.sleep(.2)
    print("Submitting Info")
    browser.find_by_name('commit').click()
    time.sleep(1)

    browser.driver.save_screenshot('confirmation.png')
    print("Exiting...")
    time.sleep(2)
    sys.exit(0)
Exemple #33
0
def splinter(url):
    #"""""""""""""""""""""""""MySQL DEF**********************************************
    conn = MySQLdb.connect(host='192.168.1.8',user='******',passwd='123123',db='gwycf')
    cursor = conn.cursor()#create cursor operate db
    #"""""""""""""""""""""""""MySQL DEF**********************************************
    data = xlrd.open_workbook('./chafen.xlsx')
    table = data.sheets()[0]
    nrows = table.nrows 
    ncols = table.ncols
    print nrows
    
    browser = Browser('firefox')
#    browser = Browser('chrome')
    dir(browser)
    browser.visit(url)
    time.sleep(5)
    count = 0
    #<================================================>
    for i in range(nrows):
        #HaoMa = str(table.row_values(i)[1]).split(".")[0]
        name = table.row_values(i)[0]
        HaoMa = table.row_values(i)[1]
#        epost = table.row_values(i)[2]

        browser.find_by_name('TxtName').fill(name)
        browser.find_by_name('TxtHaoMa').fill(HaoMa)
        browser.find_by_id('btnSubmit').click()
	#=================获取页面数据=====================
        epost = browser.find_by_tag('td')[10].value
        ecode = browser.find_by_tag('td')[14].value
        xingce = browser.find_by_tag('td')[16].value
        shenlun = browser.find_by_tag('td')[18].value
        jiafen = browser.find_by_tag('td')[20].value
        zongfen = browser.find_by_tag('td')[22].value
	#=================获取页面数据======================
        query = u"insert into info values('%s','%s','%s','%s','%s','%s','%s','%s',0)" % (name,HaoMa,epost,ecode,xingce,shenlun,jiafen,zongfen)
        print count,query
        cursor.execute(query.encode('utf-8')) #原始数据可以根据gbk运行无错,现在改成utf8
        conn.commit()
        browser.back()
        count = count +1
    cursor.close()
    conn.commit()
    conn.close()
Exemple #34
0
def main():
    browser = Browser()
    browser.visit("https://github.com/login")
    browser.fill('wd','python')
    button = browser.find_by_name('login')
    button.click()
    if browser.is_text_present('splinter.cobrateam.info'):
        print("Yes, the official website was found!")
    else:
        print("No, it wasn't found... We need to improve our SEO techniques")
Exemple #35
0
class AddTask(TestCase):

    def setUp(self):
        self._browser = Browser('django')

    def test_add_task(self):
        filename = os.path.join(os.path.dirname(__file__),
                                '../../docs/features/add_task.feature')
        run(filename, self, verbose=True)

    def step_user_exists(self, username):
        r'user "([^"]+)" exists'

        user = UserFactory.build(username=username)
        user.is_staff = True
        user.set_password(username)
        user.save()

    def step_I_visit_page_as_logged_user(self, page, username):
        r'I visit "([^"]+)" as logged user "([^"]+)"'

        self._browser.visit('/admin/')
        self._browser.fill('username', username)
        self._browser.fill('password', username)
        self._browser.find_by_value('Log in').first.click()
        self._browser.visit(page)

    def step_I_enter_value_in_field(self, value, field):
        r'I enter "([^"]+)" in field "([^"]+)"'

        self._browser.fill(field, value)

    def step_I_press(self, button):
        r'I press button "([^"]+)"'

        self._browser.find_by_name(button).first.click()

    def step_I_see_task_on_tasks_list(self, task):
        r'I see task "([^"]+)" on tasks list'

        task_on_list = self._browser.find_by_xpath('//ul[@id="todo"]/li[contains(., "%s")]' % task)
        self.assertTrue(task_on_list)
Exemple #36
0
def get_login(url):

    browser = Browser("phantomjs", service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
    browser.visit(url)

    browser.find_by_id('username').fill('*****@*****.**') # MORPH
    #browser.find_by_id('username').fill('*****@*****.**')
    #browser.find_by_id('username').fill('*****@*****.**')
    #browser.find_by_id('username').fill('*****@*****.**') # Morph uk
    browser.find_by_id('password').fill('Nrjn1gsa')
    browser.find_by_name('submit').first.click()
    time.sleep(1)
    print browser.url
    browser.click_link_by_href("/business/opportunitySearchForm.html")
    time.sleep(1)
    browser.select('status', "")
    browser.find_by_value("Search").first.click()
    time.sleep(2)
    print browser.url
    return browser
Exemple #37
0
def publish():
    browser = Browser('chrome')
    browser.visit("http://www.douban.com")
    a = raw_input("waiting 4 logining...")
    del (a)
    print("start working!let`s do this!")
    while 1:

        browser.visit("http://www.douban.com/group/topic/47136089/?start=10000"
                      )  #這裏換上自己帖子的地址
        # content = getLrc()
        content = getLrc()
        while "document.write" in content or len(content) < 150:
            content = getLrc()

        content = content[56:-11]

        browser.find_by_id("last").fill(content)
        browser.find_by_name("submit_btn").click()
        time.sleep(random.randrange(60, 300))  #適當調大一些 可以免去驗證碼煩惱
def advanced_search(pub_id, search_term,  user_name, password, year=None, sports=False, phantom=False):
    if phantom == True:
        browser = Browser('phantomjs')
    else:
        browser = Browser('firefox')
    login(browser, user_name, password)
    button = browser.find_by_name('doLogin').first.click()
    browser.click_link_by_href('advanced')
    browser.fill('queryTermField', pub_id)
    browser.fill('queryTermField_0', search_term)
    browser.select('fieldsSelect_0', 'all')
    if sports == False:
        browser.select('opsSelect_0', 'NOT')
        browser.fill('queryTermField_1', 'sports')
        browser.select('fieldsSelect_1', 'ti')
    if year != None:
        browser.select('select_multiDateRange', 'ON')
        browser.fill('year2', year)
    search_but = browser.find_by_name('searchToResultPage').first.click()
    return browser
Exemple #39
0
def api_construct(
    domain: str, username: str, password: str, browser_name: str = "firefox"
) -> Browser:
    """ Lifecycle creation
        Logs in, and returns a headless browser at the DNS page
    """

    headless = not is_verbose()
    if browser_name == "chrome":

        # need this to run as root in a container
        options = ChromeOptions()
        options.add_argument("--no-sandbox")

        browser = Browser(browser_name, headless=headless, options=options)

    # UGH Browser for FF cannot take an options arg!
    # in the current splinter 1.14.0 at least
    elif browser_name == "firefox":
        browser = Browser(browser_name, headless=headless)

    else:
        raise RuntimeError(f"Unsupported browser: {browser}")

    browser.visit("https://domains.google.com/registrar/")

    link = browser.links.find_by_partial_text("Sign")
    link.click()

    # Enter username, wait, enter password
    browser.find_by_id("identifierId").fill(username)
    click_next(browser)

    wait_for_tag(browser, "div", "Enter your password")

    browser.find_by_name("password").fill(password)
    click_next(browser)

    browser.visit(f"https://domains.google.com/registrar/{domain}/dns")
    wait_for_tag(browser, "h3", "Synthetic records")
    return browser
Exemple #40
0
def getstatus(pnr):
    browser = Browser()
    url = "http://www.indianrail.gov.in/pnr_Enq.html"
    browser.visit(url)
    time.sleep(5)
    browser.fill("lccp_pnrno1", pnr)
    browser.find_by_name("submit").click()
    time.sleep(2)
    soup = BeautifulSoup(browser.html, "html.parser")
    status = soup.findAll('td', {'class': 'table_border_both'})
    string = ""

    string = "PNR:" + pnr + "," + "TRAIN:" + status[0].text

    string = string + ",DOJ:" + status[2].text.replace(" ", "") + ",CLASS:" + status[7].text.replace(" ", "") + "," + \
             status[3].text.replace(" ", "") + "-" + status[4].text.replace(" ", "")
    string = string + "," + "BOOK:" + status[9].text.replace(" ", "") + ",CUR:" + status[10].text.replace(" ",
                                                                                                          "") + ",FARE:" + \
             status[11].text

    return string
Exemple #41
0
    def passwd(self):
        b = Browser()
        b.driver.set_window_size(900,900)
	try:
            b.visit("https://twitter.com")
            btn = b.find_by_css(".js-login")
            btn.click()
            b.find_by_name("session[username_or_email]").fill(self.user)
            b.find_by_name("session[password]").fill(self.login)
            btn = b.find_by_value("Log in")
            btn.click()
            b.visit("https://twitter.com/settings/password")
            b.fill("current_password", self.login)
            b.fill("user_password", self.panic)
            b.fill("user_password_confirmation", self.panic)

            btn = b.find_by_text("Save changes")
            btn.click()
            b.quit()
	except:
            b.quit()
def member_new(emails,link,password):
    browser=Browser('chrome')
    for n in emails:
        email=n.rstrip()+"@sgsaas.net"
        browser.visit(link);
        browser.fill('age',"33");
        browser.fill('firstname',"Sam");
        browser.fill('lastname',"wang");
        browser.find_by_name('email').last.fill(email);
        browser.fill('telephone',3984020);
        browser.fill('address_1',"Bukit Batok Avenue")
        browser.fill('city',"Singapore");
        browser.fill('postcode',658080);

        browser.find_by_xpath('//select[@id="input-country"]//option[@value="188"]').click();
        browser.find_by_xpath('//select[@id="input-zone"]//option[@value="4231"]').click();

        browser.find_by_name('password').last.fill(password);
        browser.fill('confirm',password);
        browser.find_by_name('agree').click();
        browser.find_by_css('.btn-primary').click();
        sleep(1)
        print email+" has registered!"
    browser.quit()
    return;
Exemple #43
0
def MAYDAY(website):
    browser1 = Browser('chrome')
    browser1.visit(website)
    #login
    browser1.find_by_name('username').fill('*****@*****.**')
    browser1.find_by_name('password').fill('LZF24685')
    browser1.find_by_name('submit').click()
def navegacion(num):
    try:
        browser = Browser()
        browser.visit('http://ugraerospaceprogram.appspot.com/')
        print "Iniciando prueba "
        browser.fill('usuario', 'test')
        browser.fill('password', '12345')
        browser.find_by_name('init_sesion').click()

        browser.find_by_name('btn_editar').click()
        browser.find_by_name('btn_inicio').click()
        browser.find_by_name('btn_monitorizacion').click()

        browser.find_by_id('tipoGrafica-temp').find_by_id(
            'element_line_temp').click()
        browser.find_by_id('botonGrafica-temp').click()

        browser.find_by_id('tipoGrafica-velocidadviento').find_by_id(
            'element_line_v').click()
        browser.find_by_id('botonGrafica-velocidadviento').click()

        browser.find_by_id('tipoGrafica-humedad').find_by_id(
            'element_line_h').click()
        browser.find_by_id('botonGrafica-humedad').click()

        browser.find_by_id('tipoGrafica-precipitacion').find_by_id(
            'element_line_p').click()
        browser.find_by_id('botonGrafica-precipitacion').click()

        browser.find_by_name('btn_estadisticas').click()

        browser.find_by_name('btn_twitter').click()

        browser.find_by_id('boton-cerrar').click()
        browser.execute_script("alert('Navegacion acabada');")
        browser.quit()
        return True
    except:
        return False
	def run(self):
		browser = Browser('chrome', executable_path=EXECUTABLE_PATH, service_args=PROXIES)
		# browser = Browser('phantomjs', service_args=PROXIES, user_agent=USER_AGENT)
		with browser:
			page = 1
			browser.visit(URL)
			browser.fill("q", KEYWORD)
			browser.find_by_name("btnG").click()
			time.sleep(5)

			while True:
				time.sleep(10)
				logging.info("Page " + str(page))
				for link in browser.find_by_css("h3.r"):
					if "applicationname" in link.find_by_css("a").first["href"].lower():
						self.url_queue.put(link.find_by_css("a").first["href"])
				page += 1
				if browser.find_by_css("#pnnext"):
					browser.find_by_css("#pnnext").click()
				else:
					break
			self.url_queue.put(None)
Exemple #46
0
def main(username, password):
    try:
        browser = Browser('firefox')
    except selenium.common.exceptions.WebDriverException:
        import os
        binpath = os.path.expanduser('~/.local/bin/geckodriver')
        tarpath = '/tmp/geckodriver.tar.gz'
        os.environ['PATH'] = os.path.dirname(
            binpath) + ':' + os.environ['PATH']
        if not os.path.exists(binpath):
            from six.moves import urllib
            from tarfile import TarFile
            import shutil
            if not os.path.exists(tarpath):
                urllib.request.urlretrieve(
                    'https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz',
                    tarpath)
            with TarFile.open(tarpath) as f:
                f.extractall()
            try:
                os.makedirs(os.path.dirname(binpath))
            except OSError:
                pass
            shutil.move('geckodriver', binpath)

    browser = Browser(
        'firefox',
        headless=True,
        user_agent=
        'SoftBank/2.0/004SH/SHJ001/SN 12345678901 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1'
    )
    browser.visit('http://furushchev.ru')
    if browser.is_element_not_present_by_name('login', wait_time=10):
        print('Failed to login or you are already logged in')
    else:
        browser.fill('SWUserName', username)
        browser.fill('SWPassword', password)
        browser.find_by_name('login').click()
        print('Successfully logged in!')
def run(search_term):
    first_name = search_term
    browser = Browser()
#browser = Browser('zope.testbrowser', ignore_robots=True)
    browser.visit('http://uoregon.edu/findpeople')
    browser.fill('name', search_term)
    browser.find_by_name('op').first.click()
    if (len(browser.url) > len('http://uoregon.edu/findpeople/person/'+first_name+'/')) == 6:
        print "Found"
        #return results #FIXME: Add results grab
    if browser.find_by_text('No results were found.') == True:
        print "Not Found"
        #return None
    if browser.is_element_present_by_css('findpeople-list') == True:
        print "Found Many"
        #search options including middle initial
        #if multiple results:
           #search options including level
    elif browser.is_element_present_by_css('findpeople-person') == True:
        run(first_name)
    else:
        print "Not Found2"
Exemple #48
0
def get_login(url):

    browser = Browser("phantomjs", service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
    browser.visit(url)

    #browser.find_by_id('username').fill('*****@*****.**') # MORPH
    #browser.find_by_id('username').fill('*****@*****.**')

    #browser.find_by_id('username').fill('*****@*****.**')
    browser.find_by_id('username').fill('*****@*****.**')   # MORPH UK
    browser.find_by_id('password').fill('Nrjn1gsa')
    browser.find_by_name('submit').first.click()
    time.sleep(1)
    print browser.url
    try:
        browser.click_link_by_href("/business/opportunitySearchForm.html")
        time.sleep(1)
        browser.click_link_by_href("opportunityAdvancedSearchForm.html")
        time.sleep(2)
        #browser.find_by_value('All').first.click()
        browser.select('status', "")
        browser.select('area', "9")         # 'area' is 'class name' not just name?
        time.sleep(3)
        print browser.find_by_value('Add All')              #TODO
        print browser.html
        browser.find_by_value('Add All').first.click()
        print 'added all England only' #TODO
        time.sleep(2)
        browser.find_by_value("Search").first.click()
        time.sleep(2)
    except Exception as e:
        print 'error: ', e
        browser.click_link_by_href("/business/logoutHosts.html")
        time.sleep(4)
        browser.quit()
        sys.exit("login failed")
    print browser.url
    return browser
Exemple #49
0
class DersSecimi:
    def __init__(self):
        self.success = False
        os.system("cls")
        print(
            "**************** KOU DERS SECIMI v1.0 For Windows-64 Bit ****************"
        )
        self.ogrNo = input("Ogrenci Numaraniz: ")
        self.sifre = input("Ogrenci Bilgi Sistemi Sifreniz: ")
        print(self.ogrNo + " Numarası ve " + self.sifre +
              " sifresi ile giris yapiliyor..")
        self.browser = Browser('chrome')

    url = "https://ogr.kocaeli.edu.tr/koubs/ogrenci/index.cfm"

    def brute_force(self):
        self.browser.find_by_name(name="OgrNo").fill(self.ogrNo)
        self.browser.find_by_name(name="Sifre").fill(self.sifre)
        self.browser.find_by_name('Ara').click()
        if self.browser.is_text_present('Ders İşlemleri'):
            print(
                "Giris Basari Ile Saglandi. Ders Secimini Tamamlamadan Bu Pencereyi Kapamayin."
            )
            self.success = True
            time.sleep(3600)
        else:
            self.brute_force()
            time.sleep(1)

    def start(self):
        print("--------------------------------------------")
        print("Google Chrome Baslatiliyor...")
        print("--------------------------------------------")
        self.browser.visit(self.url)
        print("Google Chrome Basari Ile Baslatildi.")
        print("--------------------------------------------")
        print("Ogrenci Bilgi Sistemine Giriliyor..")
        self.brute_force()
Exemple #50
0
	def run(self):
		while True:
			keyword = self.keyword_queue.get()
			if keyword is None:
				self.keyword_queue.put(keyword)
				break
			else:
				self.keyword = keyword
				browser = Browser('phantomjs', service_args=proxies)
				with browser:
					browser.visit(self.url)
					browser.fill('q', self.keyword)
					browser.find_by_name('gosearch').click()
					self.job_entries = 0
					while True:
						nxt = browser.find_by_css('li.next')
						if len(nxt) > 0:
							self.__scrape(browser.html.encode('utf-8'))
							browser.find_by_css('li.next > a').first.click()
						else:
							self.__scrape(browser.html.encode('utf-8'))
							break
					print "Worker %d - %d entries found for the keyword '%s'" % (self.ID, self.job_entries, self.keyword)
Exemple #51
0
def main():
    browser = Browser()
    browser.visit('http://www.baidu.com')
    browser.fill('q', 'splinter - python acceptance testing for web applications')
    button = browser.find_by_name('btnK')
    button.click()

    if browser.is_text_present('splinter.cobrateam.info'):
        print 'yes, the official website was found!'
    else:
        print "No, it wasn't found... We need o improve our SEO techniques"

    
    browser.quit()
Exemple #52
0
def Login(userName, Password):
    br = Browser('chrome')
    urlLogin = "******"
    br.visit(urlLogin)
    soup = BeautifulSoup(br.html)
    if soup.get_text().find("Login") == -1:     #can't find Login page
        br.quit()
        return br, False
    #print br.html
    br.fill("user_name", userName)
    br.fill("user_password", Password)
    button = br.find_by_name('not_important')
    button.click()
    soup = BeautifulSoup(br.html)
    if soup.get_text().find("Welcome:") == -1:  #didn't login ok
        br.quit()
        return br, False
    return br, True
Exemple #53
-1
def getRoutes(start,end):
    browser = Browser(
        driver_name="firefox"
)
    browser.visit('https://www.hopstop.com/search?xfr=cityscape')
    print(browser.url)
    browser.fill('address1',str(start))
    browser.fill('address2',str(end))
    browser.find_by_name('get_dirs').click()
    print(browser.url)
    if browser.is_text_present('Did you mean?'):
        print "better at least get here"
        #browser.click_link_by_href("#") 
        for link in browser.find_link_by_href("#"):
            print "Okay"
            if link.visible == True:
                print link.text
                browser.click_link_by_text(link.text)
                break
    browser.click_link_by_href("#")
    links = browser.find_link_by_partial_href("/station?stid")
    results = []
    for link in links:
        results.append(link.value)
    browser.quit()
    return results