def setUp(self):
     from platform import system as osname
     if (osname() == 'Windows'):
         chromedriverpath = r'C:\tools\chromedriver\chromedriver.exe'
     elif (osname() == 'Linux'):
         chromedriverpath = '/opt/google/chromedriver/chromedriver'
     else:
         chromedriverpath = r'C:\tools\chromedriver\chromedriver.exe'
     self.driver = webdriver.Chrome(chromedriverpath)
     self.driver.implicitly_wait(10)
     self.base_url = "https://mengkome.pythonanywhere.com/admin/login/"
     self.verificationErrors = []
 def setUp(self, browser='chrome'):
     print('\n--- > setUp\n')
     # self.driver = webdriver.Firefox()
     if browser == 'brave':
         brave_exe = r'C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe'
         self.chromedriverpath = r'C:\tools\chromedriver\chromedriver_v81.exe'
         self.chrome_options = Options()
         self.chrome_options.add_argument('--ignore-certificate-errors')
         self.chrome_options.add_argument("--disable-web-security")
         self.chrome_options.add_argument("--incognito")
         self.chrome_options.add_argument(
             "--allow-running-insecure-content")
         self.chrome_options.add_argument(
             "--allow-cross-origin-auth-prompt")
         self.chrome_options.add_argument("--disable-cookie-encryption")
         self.chrome_options.add_argument('--disable-dev-shm-usage')
         self.chrome_options.add_argument("--test-type")
         self.chrome_options.binary_location = brave_exe
         ## webdriver section
         self.driver = webdriver.Chrome(self.chromedriverpath,
                                        options=self.chrome_options)
         # pass
     else:
         from platform import system as osname
         if (osname() == 'Windows'):
             self.chromedriverpath = r'C:\tools\chromedriver\chromedriver.exe'
         elif (osname() == 'Linux'):
             self.chromedriverpath = '/opt/google/chromedriver/chromedriver'
         else:
             self.chromedriverpath = r'C:\tools\chromedriver\chromedriver.exe'
         self.chrome_options = Options()
         self.chrome_options.add_argument('--ignore-certificate-errors')
         self.chrome_options.add_argument("--disable-web-security")
         self.chrome_options.add_argument("--incognito")
         self.chrome_options.add_argument(
             "--allow-running-insecure-content")
         self.chrome_options.add_argument(
             "--allow-cross-origin-auth-prompt")
         self.chrome_options.add_argument("--disable-cookie-encryption")
         self.chrome_options.add_argument('--disable-dev-shm-usage')
         self.chrome_options.add_argument("--test-type")
         ## webdriver section
         self.driver = webdriver.Chrome(self.chromedriverpath,
                                        options=self.chrome_options)
     self.driver.implicitly_wait(10)
     self.base_url = "https://www.google.co.uk"
     self.verificationErrors = []
     self.tmpfilename = 'tmptest123-' + str(
         strftime("%Y-%m-%d-%H-%M-%S")) + '.pdf'
Beispiel #3
0
 def getDriverTruePathFromOS(self, browser='chrome'):
     chromedriverexe = ''
     chromedriverbin = ''
     from platform import system as osname
     if (osname() == 'Windows'):
         if (browser == 'chrome'):
             chromedriverexe = r'C:\tools\chromedriver\chromedriver.exe'
         elif (browser == 'brave'):
             chromedriverexe = r'C:\tools\chromedriver\chromedriver.exe'
             brave_exe = r'C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe'
             chromedriverbin = brave_exe
     elif (osname() == 'Linux'):
         if (browser == 'chrome'):
             chromedriverexe = '/opt/google/chromedriver/chromedriver'
         else:
             print('Browser other than Chrome not supported yet')
     else:
         print('OS ' + str(osname()) + ' is not support yet')
         # chromedriverexe = r'C:\tools\chromedriver\chromedriver.exe'
     return chromedriverexe, chromedriverbin
def browserDriver(browser='chrome'):
    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    print('\n--- > start browser')
    if browser=='brave':
        brave_exe=r'C:\Program Files (x86)\BraveSoftware\Brave-Browser\Application\brave.exe'
        chromedriverpath = r'C:\tools\chromedriver\chromedriver.exe'
        chrome_options = Options()
        chrome_options.add_argument('--ignore-certificate-errors')
        chrome_options.add_argument("--disable-web-security")
        chrome_options.add_argument("--incognito")
        chrome_options.add_argument("--allow-running-insecure-content")
        chrome_options.add_argument("--allow-cross-origin-auth-prompt")
        chrome_options.add_argument("--disable-cookie-encryption")
        chrome_options.add_argument('--disable-dev-shm-usage')
        # chrome_options.add_argument("--test-type")
        chrome_options.binary_location = brave_exe
        driver = webdriver.Chrome(chromedriverpath, options=chrome_options)
    else:
        from platform import system as osname
        if (osname() == 'Windows'):
            chromedriverpath = r'C:\tools\chromedriver\chromedriver.exe'
        elif (osname() == 'Linux'):
            chromedriverpath = '/opt/google/chromedriver/chromedriver'
        else:
            chromedriverpath = r'C:\tools\chromedriver\chromedriver.exe'
        chrome_options = Options()
        chrome_options.add_argument('--ignore-certificate-errors')
        chrome_options.add_argument("--disable-web-security")
        chrome_options.add_argument("--incognito")
        chrome_options.add_argument("--allow-running-insecure-content")
        chrome_options.add_argument("--allow-cross-origin-auth-prompt")
        chrome_options.add_argument("--disable-cookie-encryption")
        chrome_options.add_argument('--disable-dev-shm-usage')
        # chrome_options.add_argument("--test-type")
        driver = webdriver.Chrome(chromedriverpath, options=chrome_options)
    driver.maximize_window()
    driver.implicitly_wait(10)
    print('--- > browser driver now ready\n')
    return driver
 def setUp(self):
     from platform import system as osname
     if (osname() == 'Windows'):
         self.chromedriverpath = r'C:\tools\chromedriver\chromedriver.exe'
     elif (osname() == 'Linux'):
         self.chromedriverpath = '/opt/google/chromedriver/chromedriver'
     else:
         self.chromedriverpath = r'C:\tools\chromedriver\chromedriver.exe'
     self.base_url = "https://mengkome.pythonanywhere.com/admin/login/"
     self.chrome_options = Options()
     self.chrome_options.add_argument('--ignore-certificate-errors')
     self.chrome_options.add_argument("--disable-web-security")
     self.chrome_options.add_argument("--incognito")
     self.chrome_options.add_argument("--allow-running-insecure-content")
     self.chrome_options.add_argument("--allow-cross-origin-auth-prompt")
     self.chrome_options.add_argument("--disable-cookie-encryption")
     self.chrome_options.add_argument('--disable-dev-shm-usage')
     self.chrome_options.add_argument("--test-type")
     ## webdriver section
     self.driver = webdriver.Chrome(self.chromedriverpath,
                                    options=self.chrome_options)
     print('\n--- >> SETUP')
     self.__class__.ixi = self.__class__.ixi + 1
from os import system
from os import name
from sys import stdout
from time import sleep
from sys import exit
from platform import system as osname

def clear():
    if name == 'nt':
        system('cls')
    else:
        system('clear')

lintest = osname()
if lintest == 'Linux':
    pkgin = input('pkg manger example (apt install "space!!!!") : ')
else:
    pass
clear()
print('remember stay at the good directory ')
sleep(6)
clear()
def slowprint(s):
    for c in s + '\n':
        stdout.write(c)
        stdout.flush()
        sleep(10. / 100)


with open('name.txt', 'r') as f:
    lines = f.read().splitlines()
Beispiel #7
0
def clear():
    if osname() == "Windows":
        execute("cls")
    else:
        execute("clear")