Exemple #1
0
    def test(self):
        try:

            print("The test has began with Cadastro individual number:", self.cpf, "time:", self.time, "ssid:", self.ssid, self.nome, self.telefone, self.mail)
            result = connect(self.ssid, ip_address='192.168.4.61/24', ip_gw='192.168.4.1', dns_address='8.8.8.8', wireless_int='wlp2s0').run()
            if result:
                print("in test, result is:", result)
                options = webdriver.ChromeOptions()
                options.add_argument('--no-sandbox')
                browser = webdriver.Chrome('/chromedriver', chrome_options=options)
                browser.set_page_load_timeout(15)
                browser.get("http://www.ufsc.br")
                browser.find_element_by_id("cpf").send_keys(self.cpf)
                browser.find_element_by_id("name").send_keys(self.nome)
                browser.find_element_by_id("email").send_keys(self.mail)
                browser.find_element_by_id("phone").send_keys(self.telefone)
                browser.find_element_by_class_name("btn-primary").click()

                try:
                    urlAlert = browser.find_element_by_xpath(
                        "/html/body/div/div/div/div[2]/form/div[@class=\'alert alert-danger\']")
                    print("Atingiu o tempo limite")
                    return False

                except:
                    print("exception urlAlert")

                try:
                    urlSucc = browser.find_element_by_xpath(
                        "/html/body/div/div/div/div[2]/form/div[@class=\'alert alert-success\']")


                    print("check in success")
                    result = sock('8.8.8.8', self.time).run()
                    if result:
                        print('slef.time=', self.time)
                        time.sleep(self.time)
                        result = sock('8.8.8.8', self.time).run()
                        if result:
                            print("Was with access yet")
                            return False
                        else:
                            print("has blocked the access, success!!")
                            return True
                    else:
                        print("Not yet connected")
                        return False


                except:
                    print("exception urlSucc")
                    return False

            else:
                print("in Voucher, was not able to connect on SSID: ", self.ssid["ssid"], result)
                return False

        except:
            print("Something went wrong on CPF module with:", sys.exc_info()[0], sys.exc_info()[1])
Exemple #2
0
    def test(self):
        try:

            print("The test has began with voucher number:", self.vnumber, "time:", self.time, "ssid:", self.ssid)
            result = connect(self.ssid).run()
            if result:
                print("in test, result is:", result)
                options = webdriver.ChromeOptions()
                options.add_argument('--no-sandbox')
                browser = webdriver.Chrome('/home/lu050023/ChromeDriver/chromedriver', chrome_options=options)
                browser.set_page_load_timeout(10)
                browser.get('http://www.ufsc.br')
                browser.find_element_by_id("voucher").send_keys(self.vnumber)
                browser.find_element_by_xpath("/html/body/div/div/div/div[2]/form/div[2]/button").click()
                try:
                    urlAlert = browser.find_element_by_xpath("/html/body/div/div/div/div[2]/form/div[@class=\'alert alert-danger\']")
                    print("Atingiu o tempo limite")
                    return False

                except:
                    print("exception urlAlert")



                try:
                    urlSucc = browser.find_element_by_xpath("/html/body/div/div/div/div[2]/form/div[@class=\'alert alert-success\']")
                    print("check in success")
                    result = sock('8.8.8.8', self.time).run()

                except:
                    print("exception urlSucc")
                    return False

                if result:
                    print("Success Socket!")
                    return True

                else:
                    print("Error Socket!")
                    return False
            else:
                print("in Voucher, was not able to connect on SSID: ", self.ssid["ssid"], result)
                return False

        except:
            print("Something went wrong on Voucher module with:", sys.exc_info()[0], sys.exc_info()[1])
    def test(self):
        Global = Global_variables
        try:

            print("The test has began with password:"******"time:",
                  self.time, "ssid:", self.ssid)
            result = connect(self.ssid,
                             ip_address=Global('WirelessIp').get(),
                             ip_gw=Global('WirelessGw').get(),
                             dns_address=Global('Dns').get(),
                             wireless_int=Global('WirelessInt').get()).run()
            if result:

                print("in test, result is:", result)
                options = webdriver.ChromeOptions()
                options.add_argument('--no-sandbox')
                options.add_argument('--disable-application-cache')
                driver = webdriver.Chrome(Global('directory').get(),
                                          chrome_options=options)
                driver.set_page_load_timeout(45)
                driver.get('http://www.ufsc.br')
                driver.find_element_by_id("password").send_keys(self.password)
                driver.find_element_by_id("btSend").click()

                try:
                    urlAlert = driver.find_element_by_xpath(
                        "/html/body/div/div/div/div[2]/form/div[@class=\'alert alert-danger\']"
                    )
                    print("Atingiu o tempo limite")
                    return 0
                except:
                    print("exception urlAlert")
                '''
                try:
                    urlAlert = driver.find_element_by_class_name("alert alert-danger")
                    print("Senha incorreta")
                    return 0
                except:
                    print("exception urlAlert")
                '''

                try:
                    urlSucc = driver.find_element_by_xpath(
                        "/html/body/div/div/div/div[2]/form/div[@class=\'alert alert-success\']"
                    )
                    print("check in success")
                    driver.close()
                    result = sock('8.8.8.8', self.time).run()
                    if result:
                        print('sleep.time=', self.time)
                        time.sleep(self.time)
                        result = sock('8.8.8.8', self.time).run()
                        if result:
                            print("Was with access yet")
                            return 0
                        else:
                            print("has blocked the access, success!!")
                            return 1
                    else:
                        print("Not yet connected")
                        return 0

                except:
                    print("exception urlSucc")
                    return 0

            else:
                print("in Password, was not able to connect on SSID: ",
                      self.ssid["ssid"], result)
                return 0

        except:
            print("Something went wrong on Password module with:",
                  sys.exc_info()[0],
                  sys.exc_info()[1])