Skip to content

Instantly share code, notes, and snippets.

@SarahElson
SarahElson / dockerfile
Last active August 17, 2022 12:31
Podman vs Docker: All You Need To Know!
FROM node:16
# Create app directory
WORKDIR /usr/src/app
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
@SarahElson
SarahElson / Step 1
Last active August 9, 2022 16:08
A Complete Guide To AngularJS Testing
<script>
src=”https://angularjs/angle.js”
</script>
@SarahElson
SarahElson / Step 2
Created August 9, 2022 16:06
A Complete Guide To AngularJS Testing
<div ng-app = “”>
........
</div>
@SarahElson
SarahElson / Step 3
Created August 9, 2022 16:06
A Complete Guide To AngularJS Testing
<p> Enter your Required Name: <input type = “text” ng-model = “name”></p>
@SarahElson
SarahElson / Step 4
Created August 9, 2022 16:07
A Complete Guide To AngularJS Testing
<p> Hello <span ng-bind = “name”></span>!</p>
@SarahElson
SarahElson / locators.py
Last active September 28, 2022 16:03
How To Download File Using Selenium Python?
from selenium.webdriver.common.by import By
class SeleniumPlaygroundPageLocators(object):
#locators
file_download = (By.XPATH, '//li[.="File Download"]')
data_field = (By.XPATH, '//*[@id="textbox"]')
generate_file = (By.ID, 'create')
download_button = (By.XPATH, '//*[@id="link-to-download"]')
@SarahElson
SarahElson / conftest.py
Last active August 12, 2022 14:38
How To Download File Using Selenium Python?
import unittest
from selenium import webdriver
class Browser(unittest.TestCase):
def setUp(self):
PATH = "/Users/macbookair/Desktop/how_download_files_selenium_python/download"
#Safari
self.driver = webdriver.Safari()
self.driver.get("https://www.lambdatest.com/selenium-playground/")
def tearDown(self):
self.driver.close()
@SarahElson
SarahElson / selenium_playground_page.py
Last active August 12, 2022 14:38
How To Download File Using Selenium Python?
from selenium.webdriver.common.keys import Keys
from utils.locators import *
import time
# Page objects are written in this module.
class Selenium_Playground_Page():
def __init__(self, driver):
self.locator = SeleniumPlaygroundPageLocators
self.driver = driver
@SarahElson
SarahElson / conftest.py
Last active August 12, 2022 14:37
How To Download File Using Selenium Python?
import unittest
from selenium import webdriver
class Browser(unittest.TestCase):
def setUp(self):
PATH = "/Users/macbookair/Desktop/how_download_files_selenium_python/download" #This path must be modified according to your OS and the directory where you want to save your file
self.driver.get("https://www.lambdatest.com/selenium-playground/")
def tearDown(self):
self.driver.close()
if __name__ == '__main__':
unittest.main()
@SarahElson
SarahElson / test_download_file.py
Last active September 28, 2022 16:02
How To Download File Using Selenium Python?
import unittest
from tests.conftest import Browser
from pages.selenium_playground_page import *
# I am using python unittest for asserting cases.
class TestDownloadFile(Browser):
def test_download(self):
page = Selenium_Playground_Page(self.driver)
download_file = page.download("How to download files using Selenium & Python?")