def get_profile(user_data, out: str): """ Gets user profile from ebird. Users webbot to login to ebird.org and searches for user profile address on sample checklist entry for user. :param checklist_url: path to a checklist url, extracted from users dataframe column :param out: path to output text file :return: None """ user_name = user_data[1].split('/')[0].strip() checklist_url = user_data[0] web = Browser(showWindow=False) web.go_to("https://secure.birds.cornell.edu/cassso/login") web.type('birds_of_a_feather', into='Username') web.type('y&2m#9B3B2NGGzp', into='Password') web.press(web.Key.ENTER) web.go_to(checklist_url) source = web.get_page_source() soup = BeautifulSoup(source, 'lxml') try: url = soup.find('a', {'title': f'Profile page for {user_name}'})['href'] profile = f"https://ebird.org/{url}" with open(out, 'a') as src: src.write(f"{checklist_url}_{profile}\n") except TypeError: with open(out, 'a') as src: src.write(f"{checklist_url}_None\n")
def webot(user, passwd): web = Browser(False) web.go_to("https://midas.unioeste.br/login/#/") time.sleep(5) web.type(user, id="login-username") web.type(passwd, id="login-password") web.press(web.Key.ENTER) time.sleep(5) web.click('Academus') time.sleep(5) web.click('MatrÃculas') time.sleep(3) data = web.get_page_source() web.close_current_tab() return data
def _automate_browser_operation(pco_username, pco_password, groups, tag): web = Browser() web.go_to('https://login.planningcenteronline.com/login/new') web.type(pco_username, id='email') web.type(pco_password, id='password') web.press(web.Key.ENTER) for g in groups: if len(g[2]) > 0: skip_group = False for t in g[2]: if t == tag[0]: skip_group = True break if skip_group: continue tag_label_for = f'tag-group-tag-{tag[0]}' web.go_to(f'https://groups.planningcenteronline.com/groups/{g[0]}/settings') time.sleep(2.0) web.click('Add tags', tag='span') web.click(tag[1], tag='label', classname='checkbox-label') time.sleep(3.0)
from webbot import Browser web = Browser() web.go_to('https://www.way2sms.com/') web.type('9999999999', id='mobileNo') #Enter your phone number web.type('YourPassword', id='password') #Enter your Way2Sms Password web.press(web.Key.ENTER) web.type('9999999999', id='mobile') #Sender phone number web.type('Text to send', id='message') #Sender Text web.click(tag='button', id='sendButton')
to = time.time() web = Browser() web.go_to(link) web.click("Entrar a la reunión") def _try(): if web.exists('This is not a real button'): return False else: return True for i in range(0, 2): _try() web.press(web.Key.ENTER) for i in range(0, 2): _try() web.type(info) web.press(web.Key.ENTER) for i in range(0, 2): if _try(): web.press(web.Key.ESCAPE) for i in range(0, 2): _try() web.press(web.Key.ENTER) #DEBUG >:V
# set all the variables to your needs period=3000 # the time period is 3200 seconds in my institute so I chose a lesser value than that login_url="" username="" password="" username_element_id="ft_un" password_element_id="ft_pd" # command line output print("This program will keep running infinitely.") print("It will refresh your login page after every",period, "seconds.") print("Press CTRL+C to exit whenever you want.") # process begins driver.go_to(login_url) driver.click(id=username_element_id) driver.type(text=username, id=username_element_id) driver.click(id=password_element_id) driver.type(text=password, id=password_element_id) driver.press(driver.Key.ENTER) # sleep for period seconds and refresh while(1): time.sleep(period) driver.refresh()
from bs4 import BeautifulSoup from webbot import Browser import csv # login information user = "******" password = "******" # goes to the page and logs in web = Browser() web.go_to('https://www.zumostraining.co.uk/Login.aspx') web.type(user) web.press(web.Key.TAB) web.type(thiswontwork) web.click('Login') web.click('Ignore') web.go_to('https://www.zumostraining.co.uk/Zumos/Klik.aspx') # passes the source to BeautifulSoup content = web.get_page_source() soup = BeautifulSoup(content, 'lxml') # selects the elements with the attribute type set as an image videos = [] videos = soup.findAll("input", {'class': 'slick-slide'}) # videos is a list # prints length of the array. Used for testing print("Length:") print(len(videos)) for video in videos:
class Bot: __metaclass__ = ABCMeta web = None def __init__(self): with open("config.json") as json_file: self.config = json.load(json_file) logger.info("email " + self.config['email']) logger.info("password " + self.config['password']) logger.info("url " + self.config['url']) logger.info("max price " + str(self.config['max price'])) self.web = Browser() def send_email(self, subject, body): message = """ Subject: CCI Primers Available Found CCI Primers """ context = ssl.create_default_context() with smtplib.SMTP_SSL(smtp_server, port, context=context) as server: server.login(self.config['email'], self.config['email_pwd']) server.sendmail(self.config['email'], self.config['email'], message) @abstractmethod def restock_check(self): """ This method should be defined in a derived class as it is different for different sites :return: """ @abstractmethod def checkout(self): """ This method should be defined in a derived class as it is is different for different sites :return: """ @abstractmethod def signout(self): """ only defined in the derived class :return: """ def search(self, product): self.web.type(product, into="Search") self.web.press(self.web.Key.ENTER) results = self.web.find_elements(classname="product-finding-container") logger.info("Found " + results) @abstractmethod def check_for_available(self): """ only defined in the derived class :return: """ @abstractmethod def checkout(self): ''' ''' # finish the buy @abstractmethod def add_to_cart(self): """ only defined in the derived class :return: """ def price_check(self): price = self.get_price() if price == -1: return False if price <= self.config['max price']: return True else: return False @abstractmethod def get_price(self): """ only defined in the derived class :return: """ def get_config(self): return self.config