def drivergen(): # --------------------------------------handle the driver-----------------------------------------------# print( "\n\nDownload the driver and put it in the same folder with this file") print("Detecting drivers in current folder: " + os.getcwd() + "...") if not ChromeDriverExist() and MsEdgeDriverExist(): print("Found Edge driver") br_option = input("Are you want to continue?\n>") if br_option.lower() == "y" or br_option.lower() == "yes": return Edge(executable_path=".\\msedgedriver.exe") else: PATH = inputFilepath("Full path to driver = ", blank=False, mustExist=True) return Edge(executable_path=PATH) elif not MsEdgeDriverExist() and ChromeDriverExist(): print("Found Chrome driver") br_option = input("Are you want to continue?\n>") if br_option.lower() == "y" or br_option.lower() == "yes": return Chrome(executable_path=".\\chromedriver.exe") else: print("Please enter full path for Chrome driver") PATH = inputFilepath("Full path to driver = ", blank=False, mustExist=True) return Chrome(executable_path=PATH) elif MsEdgeDriverExist() and ChromeDriverExist(): print("Found both edge and chrome driver, choose which?\n") print("E ------- Edge") print("C ------- Chrome") br_option = input("\nI choose ") if br_option.lower() == "c" or br_option.lower() == "chrome": print("Set to chrome") return Chrome(executable_path=".\\chromedriver.exe") else: print("Set to edge") return Edge(executable_path=".\\msedgedriver.exe") else: print("Unable to locate the driver...") print("Choose the broser type?\n") print("E ------- Edge") print("C ------- Chrome") br_option = input("\nI choose ") if br_option.lower() == "c" or br_option.lower() == "chrome": PATH = inputFilepath("Full path to driver = ", blank=False, mustExist=True) return Chrome(executable_path=PATH) else: PATH = input("FULL PATH to edge driver = ") return Edge(executable_path=PATH)
def __init__(self): self.logger = logging.getLogger(LOGGER_INSTANCE) if TARGET_BROWSER == 'chrome': self.browser = Chrome() elif TARGET_BROWSER == 'firefox': self.browser = Firefox() elif TARGET_BROWSER == 'edge': self.browser = Edge()
def setUp(self): logging.info("(Edge)## -- Entering 'setUp()' method -- ##") try: self.driver = Edge(executable_path=r'E:\Pawan\Selenium\WebAppTests_Empirix\drivers\msedgedriver.exe') self.driver.implicitly_wait(30) self.driver.maximize_window() self.driver.get("https://services.empirix.com/") except Exception as e: logging.exception("(Edge)Issue in func setUp() - " + str(e)) logging.exception(traceback.format_exc())
def setUp(self): options = EdgeOptions() options.use_chromium = True options.binary_location = "C:\\Program Files (x86)\\Microsoft\\Edge Dev\\Application\\msedge.exe" dir = os.path.dirname(os.path.realpath(__file__)) edge_driver_path = dir + "\\edgedriver_win64\\msedgedriver.exe" self.service = Service(edge_driver_path) self.service.start() self.driver = Edge(options=options, service=self.service) self.driver.implicitly_wait(30) self.driver.maximize_window() self.driver.get("http://localhost:4200")
def InitializeSession(self): try: if self.browser_type == 'CHROME': return Chrome(self.path, options=self.options) elif self.browser_type == 'FIREFOX': return Firefox(self.path, options=self.options) elif self.browser_type == 'EDGE': return Edge(self.path, options=self.options) except: sys.exit( 'Could not find driver for what you specified or there occurred unidentified error.' )
def edge_driver(request: "SubRequest") -> Union[Remote, Edge]: """Fixture for receiving selenium controlled Edge instance""" if request.cls.test_type == "edge-local": driver = Edge() else: executor = RemoteConnection(SAUCE_HUB_URL, resolve_ip=False) driver = Remote(desired_capabilities=SAUCE_EDGE, command_executor=executor) set_selenium_driver_timeouts(driver) request.cls.driver = driver yield driver driver.close()
def livingly(): url = 'https://www.livingly.com/runway/Milan+Fashion+Week+Fall+2019/Aigner/Details/browse' driver = Edge(executable_path=PATH) action_chains = ActionChains(driver) driver.get(url) WebDriverWait(driver, 5000).until(expected_conditions\ .visibility_of_element_located((By.CLASS_NAME, 'thumbnail-strip'))) content = driver.find_element_by_xpath('//ul[@class="thumbnail-strip"]') links = content.find_elements_by_tag_name('a') # Store the links beforehand because Selenium does # not update the driver with the new content paths = (link.get_attribute('href') for link in links) for path in paths: # link.click() driver.get(path) WebDriverWait(driver, 3000).until(expected_conditions\ .visibility_of_element_located((By.CLASS_NAME, 'region-image'))) try: slideshow = driver.find_element_by_xpath('//div[@class="slideshow-img-link"]') except Exception: driver.execute_script('window.history.go(-1);') else: if slideshow.is_displayed(): big_image_url = slideshow.find_element_by_tag_name('img').get_attribute('data-zoom-url') if big_image_url: # driver.get(big_image_url) driver.execute_script(f'window.open("{big_image_url}", "_blank");') # This part will right click on the image, # download it locally image = driver.find_elements_by_tag_name('img') action_chains.context_click(image).perform() # This section gets all the tabs in the # browser, closes the newly opened image # tab and returns the previous one driver.switch_to_window(driver.window_handles[1]) driver.close() driver.switch_to_window(driver.window_handles[0]) # Wait a couple of seconds before returning # going back in history driver.execute_script('window.history.go(-1);') else: driver.execute_script('window.history.go(-1);') driver.close()
def get_driver(pref): """If pref in `drivers` dict, return respective driver""" # dict[name: lambda -> WebDriver] drivers = dict( chrome=lambda: Chrome(executable_path="drivers/chromedriver"), firefox=lambda: Firefox(executable_path="drivers/firefoxdriver"), edge=lambda: Edge(executable_path="drivers/edgedriver"), ) if pref in drivers: with suppress(WebDriverException): return drivers[pref]() raise LookupError( f"Driver and/or browser for driver '{pref}' does not exist")
class Nawoka: driver = Edge(executable_path=PATH) def __init__(self): url = 'https://nawoka.fr/shop/collections/sacs/' self.driver.get(url) def check_tunnel(self): # Check that we can click on a given product WebDriverWait(self.driver, 4000).until( expected_conditions.element_to_be_clickable( (By.ID, 'btn_product_details'))) self.driver.find_element_by_id('btn_product_details').click() # Check that we can add an item to the cart, # and that we can access the cart for checkout WebDriverWait(self.driver, 2000).until( expected_conditions.element_to_be_clickable( (By.ID, 'btn_add_to_cart'))) self.driver.find_element_by_id('btn_add_to_cart').click() time.sleep(3) self.driver.find_element_by_id('link_cart').click() # driver.quit() def check_products_links(self, path=None): truth_array = [] errors = [] links = self.driver.find_elements_by_id('btn_product_details') WebDriverWait(self.driver, 3000).until(expected_conditions\ .presence_of_all_elements_located((By.ID, 'btn_product_details'))) for link in links: try: # link.click() path = link.get_attribute('href') self.driver.get(path) except Exception: # errors.append(link.current_url()) truth_array.append(False) else: truth_array.append(True) self.driver.back() # self.driver.execute_script('window.history.go(-1)') WebDriverWait(self.driver, 3000).until(expected_conditions\ .presence_of_all_elements_located((By.ID, 'btn_product_details'))) # self.driver.quit() return all(truth_array)
def spider_hero(): url = "https://pvp.qq.com/web201605/herolist.shtml" browser = Edge( executable_path= 'C:\Program Files (x86)\Microsoft\Edge\Application\msedgedriver.exe') browser.get(url) ls = browser.find_elements_by_css_selector( "body > div.wrapper > div > div > div.herolist-box > div.herolist-content > ul > li" ) hero_name = [] for i in ls: hero_name.append(i.text) browser.close() with open("hero_name.txt", 'w', encoding="utf-8") as f: for i in hero_name: f.write(i) f.write('\n') print("写入完毕")
def _open_browser(self, browser_name): """ :return: webdriver """ if browser_name == 'chrome': if self.options is not None: self.driver = Chrome(chrome_options=self.options) else: self.driver = Chrome() elif browser_name == 'ie': self.driver = Ie() elif browser_name == 'safari': self.driver = Safari() elif browser_name == 'edge': self.driver = Edge() elif browser_name == 'firefox': self.driver = Firefox() else: raise Exception('Faild input browser name') self.driver.get(self.base_url) return self.driver
def spider_equipment(): url = "https://pvp.qq.com/web201605/item.shtml" browser = Edge( executable_path= 'C:\Program Files (x86)\Microsoft\Edge\Application\msedgedriver.exe') browser.get(url) ls = browser.find_elements_by_css_selector("#Jlist-details > li") equip_name = [] for i in ls: equip_name.append(i.text) browser.close() with open("equipment_name.txt", 'w', encoding="utf-8") as f: for i in equip_name: f.write(i) f.write('\n') print("写入完毕") # spider_hero() # spider_equipment()
def main(): start_time = time.time() print("Reading profile path") file = open("PROFILE_PATH", "r") parameter1 = file.readline() parameter2 = file.readline() file.close() edge_options = EdgeOptions() edge_options.use_chromium = True #edge_options.add_argument("-inprivate") edge_options.add_experimental_option( "detach", True) # Keep browser open after the program finishes running argument1 = "user-data-dir=" + parameter1 edge_options.add_argument(argument1) argument2 = "profile-directory=" + parameter2 edge_options.add_argument(argument2) path = Service("msedgedriver.exe") browser = Edge(service=path, options=edge_options) browser.get("https://account.microsoft.com/rewards/") # Wait for manual login print(" _ _ ___ __ __ __ ") print("| | (_) |__ \ / / / / \ \ ") print("| | ___ __ _ _ _ __ ) | | |_ _ / / __ | |") print("| | / _ \ / _` | | '_ \ / / | | | | | / / '_ \| |") print("| |___| (_) | (_| | | | | |_| | | |_| |/ /| | | | |") print("|______\___/ \__, |_|_| |_(_) | |\__, /_/ |_| |_| |") print(" __/ | \_\__/ | /_/") print(" |___/ |___/ ") print("Login? (y/n)") cmd = input() if cmd == "y" or cmd == "Y": open_tabs(browser) elapsed_time = time.time() - start_time print("Search Completed in " + str(elapsed_time) + "s. Script ends.") else: print("Script ends.")
db = pymysql.connect(host='115.159.41.241', user='******', password='******', port=3306, db='db211814405') cursor = db.cursor() sql = 'CREATE TABLE IF NOT EXISTS books(' \ 'ID int(20) NOT NULL, ' \ '书名 VARCHAR(255), ' \ '价格 VARCHAR(255) ,' \ '出版社 VARCHAR(255),' \ 'PRIMARY KEY(ID))' cursor.execute(sql) web = Edge(executable_path="M.exe") html = web.get(url) time.sleep(1) web.find_element_by_xpath( '//*[@id="J_filter"]/div[1]/div[1]/a[2]').click() # 点击销量排序 # web.find_elements_by_class_name('fs-tit').click time.sleep(1) # for i in range(1000,20000,1000): # js = "var q=document.documentElement.scrollTop={}".format(i) # web.execute_script(js) # time.sleep(1) # # web.execute_script("document.documentElement.scrollTop=0") goods = web.find_elements_by_class_name('gl-warp > li')
def getcomponies(): """ Get Companies from web and write to excel file :return: """ _bases.kill_web_driver_edge() driver = Edge() componies = [] driver.get('https://www.dosab.org.tr/Alfabetik-Firmalar-Listesi') # Get links # links = [] # datalinks = driver.find_elements(By.XPATH, '/html/body/div[2]/div/ul/li/div/a') # for link in datalinks: # linkobj = { # 'link': link.get_attribute('href'), # 'name': link.text # } # links.append(linkobj) # Downlaod Mail Images # for complink in componies: # parsedlink = str(complink['link']).split('/') # mailimg = f'https://www.dosab.org.tr/dosyalar/emailler/{parsedlink[4]}_EMail.jpg' # wget.download(mailimg, "imgs") # OCR Image to text pytesseract.pytesseract.tesseract_cmd = r'C:\Users\abdul\AppData\Local\Tesseract-OCR\tesseract.exe' imgfiles = os.listdir('imgs') imgfiles.sort() for imgfile in imgfiles: compid = imgfile.split('_EMail.jpg')[0] driver.get(f'https://www.dosab.org.tr/Firma/{compid}') compname = driver.find_element(By.XPATH, '/html/body/div[2]/div/div[2]/h4').text img = cv2.imread(f'imgs/{imgfile}') emailtext = str(pytesseract.image_to_string(img, lang='eng')).replace( '\n\f', '') if '@' not in emailtext: emailtext = '' company = {'mail': emailtext, 'name': compname} componies.append(company) workbook = Workbook(excel_file_name) worksheet = workbook.add_worksheet('dosab') row = 0 hformat = workbook.add_format() hformat.set_bold() worksheet.write(row, 0, "Firma Adi", hformat) worksheet.write(row, 1, 'Mailler', hformat) row += 1 for comp in componies: worksheet.write(row, 0, comp["name"]) if '@' in comp['mail']: worksheet.write(row, 1, comp['mail']) row += 1 workbook.close() driver.close()
from selenium.webdriver import Edge driver = Edge(executable_path="../drivers/MicrosoftWebDriver.exe")
go = driver.find_element_by_xpath( "//*[@id=\"LoginComponent\"]/form/button") go.click() cookie = driver.get_cookies() with open("cookies.json", "w") as target: json.dump(cookie, target, indent=4) if __name__ == "__main__": from selenium.webdriver import edge, Edge import time import os # option=edge.webdriver() prefs = {"profile.managed_default_content_settings.images": 2} # option.add_argument("--headless") driver = Edge("./msedgedriver.exe") driver.get("https://www.pixiv.net/") if not os.path.exists("cookies.json"): login(driver, input("用户名"), input("密码")) with open("cookies.json", "r") as f: cookies = json.load(f) for cookie in cookies: #del cookie["domain"] driver.add_cookie(cookie) res = driver.get("https://accounts.pixiv.net/login") if driver.current_url != "https://www.pixiv.net/": login(driver, input("用户名"), input("密码"))
def setUpClass(cls): super().setUpClass() cls.web_driver = Edge() cls.web_driver.maximize_window() cls.web_driver.implicitly_wait(IMPLICIT_WAIT_TIME)
def get_driver(): global driver if not driver: driver = Edge() driver.implicitly_wait(5) return driver()
def __init__(self, url): self.driver = Edge(executable_path=PATH) self.driver.get(url)
def open_browser(executable_path="msedgedriver", edge_args=None, desired_capabilities=None, **kwargs): """Open Edge browser instance and cache the driver. Parameters ---------- executable_path : str (Default "msedgedriver") path to the executable. If the default is used it assumes the executable is in the $PATH. port : int (Default 0) port you would like the service to run, if left as 0, a free port will be found. desired_capabilities : dict (Default None) Dictionary object with non-browser specific capabilities only, such as "proxy" or "loggingPref". chrome_args : Optional arguments to modify browser settings """ options = Options() options.use_chromium = True # Gets rid of Devtools listening .... printing # other non-sensical error messages options.add_experimental_option('excludeSwitches', ['enable-logging']) if platform.system().lower() == "windows": options.set_capability("platform", "WINDOWS") if platform.system().lower() == "linux": options.set_capability("platform", "LINUX") if platform.system().lower() == "darwin": options.set_capability("platform", "MAC") # If user wants to re-use existing browser session then # he/she has to set variable BROWSER_REUSE_ENABLED to True. # If enabled, then web driver connection details are written # to an argument file. This file enables re-use of the current # chrome session. # # When variables BROWSER_SESSION_ID and BROWSER_EXECUTOR_URL are # set from argument file, then OpenBrowser will use those # parameters instead of opening new chrome session. # New Remote Web Driver is created in headless mode. edge_path = kwargs.get( 'edge_path', None) or BuiltIn().get_variable_value('${EDGE_PATH}') if edge_path: options.binary_location = edge_path if user.is_root() or user.is_docker(): options.add_argument("no-sandbox") if edge_args: if any('--headless' in _.lower() for _ in edge_args): CONFIG.set_value('Headless', True) for item in edge_args: options.add_argument(item.lstrip()) options.add_argument("start-maximized") options.add_argument("--disable-notifications") if 'headless' in kwargs: CONFIG.set_value('Headless', True) options.add_argument("--headless") if 'prefs' in kwargs: if isinstance(kwargs.get('prefs'), dict): prefs = kwargs.get('prefs') else: prefs = util.prefs_to_dict(kwargs.get('prefs').strip()) options.add_experimental_option('prefs', prefs) logger.warn("prefs: {}".format(prefs)) driver = Edge(BuiltIn().get_variable_value('${EDGEDRIVER_PATH}') or executable_path, options=options, capabilities=desired_capabilities) browser.cache_browser(driver) return driver
def get_driver(): driver = Edge() return driver
def selenium_parser(url, xpath, url_suffix=None): """ Selenium pages by retrieving the links to each team roster in the menu dropdown """ # driver = Edge(executable_path='C:\\Users\\Pende\\Documents\\edge_driver\\msedgedriver.exe') driver = Edge(executable_path=os.environ.get('EDGE_DRIVER')) driver.get(url) time.sleep(2) nav_ul = driver.find_element_by_xpath(xpath) links = nav_ul.find_elements_by_tag_name('a') list_of_urls = [] for index, link in enumerate(links): country = f'NOCOUNTRY{index}' href = link.get_attribute('href') if '/en/volleyball' in href: is_match = re.search(r'\/teams\/(\w+)\-(.*)', href) if is_match: country = is_match.group(1).upper() if 'Teams.asp' in href \ or 'Team=' in href \ or '/Teams/' in href: is_match = re.search(r'Team\=(.*)', href) if is_match: country = is_match.group(1) if '/competions/teams/' in href: is_match = re.search(r'teams\/(\w+)(?=\-|\s+)', href) if is_match: country = is_match.group(1).capitalize() if url_suffix: href = f'{href}/{url_suffix}' list_of_urls.append((href, country)) list_of_urls = list(set(list_of_urls)) async def writer(output_path, html): with open(output_path, 'w') as f: try: f.write(html) except: return False print(f'Writing file to {output_path}') asyncio.sleep(1) async def main(output_path, html): return await writer(output_path, html) for list_of_url in list_of_urls: driver.get(list_of_url[0]) # We just retrieve the body for # simplification instead of taking # the full HTML tag body = driver.find_element_by_tag_name('body') output_path = os.path.join(PAGES_PATH, 'temp', f'{list_of_url[1]}.html') html = body.get_attribute('innerHTML') asyncio.run(main(output_path, html))
def get_componies(): _bases.kill_web_driver_edge() driver = Edge() componies = [] # region > info type headers variables sector = 'Faaliyet Alanı ' mail = 'Epostalar ' phone = 'Telefonlar ' # endregion driver.get('http://www.kosab.org.tr/FIRMALAR/') # Get table rows count pagination_count = len( driver.find_elements( By.XPATH, '/html/body/div[2]/div/div/span[2]/table/tbody/tr')) pagination_links = [] anchors = driver.find_elements( By.XPATH, f'/html/body/div[2]/div/div/span[2]/table/tbody/tr[{pagination_count}]/td/a' ) for pagelink in anchors: pagination_links.append(pagelink.get_attribute('href')) for page in pagination_links: driver.get(page) def get_comps_row(): compoinesrows = driver.find_elements( By.XPATH, '/html/body/div[2]/div/div/span[2]/table/tbody/tr') return compoinesrows for row in range(1, len(get_comps_row()) - 1): company = {} compsrow = get_comps_row() compsrow[row].click() datatable = driver.find_elements( By.XPATH, '/html/body/div[2]/div/div/span[2]/table/tbody/tr') for cell in range(0, len(datatable) - 1): datastr = str(datatable[cell].text) if cell == 0: company['Name'] = datatable[cell].text if datastr.startswith(sector): company['Sector'] = str( datatable[cell].text).split(sector)[1] if datastr.startswith(mail): company['Mail'] = str(datatable[cell].text).split(mail)[1] if datastr.startswith(phone): company['Tel'] = str(datatable[cell].text).split(phone)[1] componies.append(company) driver.back() # region > Write excel row = 0 workbook = Workbook(excel_file_name) worksheet = workbook.add_worksheet('Kosab') hformat = workbook.add_format() hformat.set_bold() hformat.set_align('center') hformat.set_align('vcenter') hformat.set_font_color('white') hformat.set_bg_color('blue') worksheet.write(0, 0, 'Firma Adi', hformat) worksheet.write(0, 1, 'Mail Adresi', hformat) worksheet.write(0, 2, 'Sektor', hformat) worksheet.write(0, 3, 'Telefon', hformat) worksheet.set_column('A:A', 70) worksheet.set_column('B:B', 40) worksheet.set_column('C:C', 40) worksheet.set_column('D:D', 30) row += 1 for cmpy in componies: if 'Name' in cmpy: worksheet.write(row, 0, str(cmpy['Name'])) if 'Mail' in cmpy: worksheet.write(row, 1, str(cmpy['Mail'])) if 'Sector' in cmpy: worksheet.write(row, 2, str(cmpy['Sector'])) if 'Tel' in cmpy: worksheet.write(row, 3, str(cmpy['Tel'])) row += 1 if os.path.exists(excel_file_name): os.remove(excel_file_name) time.sleep(2) workbook.close()
# Import Dependicies from selenium.webdriver import Edge from selenium.webdriver.support.ui import Select import time import os import shutil # Open Edge instance for navigation ref_time = time.time() # driver = Edge(executable_path=r"C:\Users\Eric\Desktop\Coding Stuff\SD_Code\SD_Auto_Driver_Install\edgedriver_win64\msedgedriver.exe") driver = Edge(executable_path=r"edgedriver_win64\msedgedriver.exe") # Navigate to specified website driver.get("https://www.nvidia.com/Download/index.aspx?lang=en-in") time.sleep(5) #This block of code sets all the dropdown menus to the correct selections #============================================================================================== # Store product type drop down menu as object and Select GeForce from dropdown menu product_type_selector = Select( driver.find_element_by_id('selProductSeriesType')) product_type_selector.select_by_value('1') product_series_selector = Select(driver.find_element_by_id('selProductSeries')) product_series_selector.select_by_visible_text('GeForce RTX 30 Series') download_type_selector = Select( driver.find_element_by_id('ddlDownloadTypeCrdGrd')) download_type_selector.select_by_visible_text('Game Ready Driver (GRD)')
from selenium.webdriver import Edge import time from bs4 import BeautifulSoup driver = Edge( 'C:\\Users\\cakarst\\IdeaProjects\\Documentation Web Scrapping\\msedgedriver.exe' ) driver.get( 'https://docs.microsoft.com//en-us//sql//t-sql//data-types//date-transact-sql?view=sql-server-ver15' ) left_nav_buttons = driver.find_elements_by_class_name('tree-item') def click_buttons(buttonList): for x in range(len(buttonList)): if buttonList[x].is_displayed() and buttonList[x].get_attribute( 'aria-expanded') == "false": driver.execute_script( "arguments[0].click();", buttonList[x].find_element_by_class_name('tree-expander')) child_list = buttonList[x].find_elements_by_class_name('tree-item') click_buttons(child_list) time.sleep(.01) ####################################################### click_buttons(left_nav_buttons) bs = BeautifulSoup(driver.page_source, 'html.parser') for link in bs.find_all(class_="tree-item is-leaf"):
from selenium.webdriver import Edge from selenium.webdriver import Firefox #edge = Edge(executable_path=r"C:\Users\U112918\Downloads\MicrosoftWebDriver.exe") driver = Edge() driver.get("http://www.wykop.pl") element = driver.find_element_by_partial_link_text( "kompresja" ) # Lapie tylko tytul linka, nie href#<a title="1K17 Kompresja - radziecki pojazd uzbrojony w lasery" href="https://www.wykop.pl/link/3816569/1k17-kompresja-radziecki-pojazd-uzbrojony-w-lasery/">1K17 Kompresja - radziecki pojazd uzbrojony w lasery</a> element.click() assert "Radziecki" in driver.title
from selenium.webdriver import Edge EXECUTABLE_PATH = 'C:\\Users\\Pende\\Downloads\\edgedriver_win64\\msedgedriver.exe' DRIVER = Edge(executable_path=EXECUTABLE_PATH)
def __init__(self): self.driver = Edge(executable_path=os.environ.get('EDGE_DRIVER')) self.driver.get('https://bumble.com')
from selenium.webdriver import Chrome, Edge, Firefox, Ie, PhantomJS, Safari ChromeDriver = lambda path, *args, **kwargs: lambda: Chrome( path, *args, **kwargs) EdgeDriver = lambda path, *args, **kwargs: lambda: Edge(path, *args, **kwargs) FirefoxDriver = lambda path, *args, **kwargs: lambda: Firefox( *args, executable_path=path, **kwargs) IeDriver = lambda path, *args, **kwargs: lambda: Ie(path, *args, **kwargs) PhantomJSDriver = lambda path, *args, **kwargs: lambda: PhantomJS( path, *args, **kwargs) SafariDriver = lambda path, *args, **kwargs: lambda: Safari( path, *args, **kwargs)