Skip to content

Instantly share code, notes, and snippets.

@SarahElson
SarahElson / env.rb
Created July 7, 2022 05:04
How To Implement Data Tables In Cucumber Using Selenium Ruby
#/support/env.rb
require 'rubygems'
require 'watir'
Before do |scenario|
$browser = Watir::Browser.new :firefox
$browser.driver.manage.window.maximize
end
After do |scenario|
@SarahElson
SarahElson / testOne.js
Last active September 15, 2022 09:28
How To Download Files Using JavaScript and Selenium
async function example() {
//To wait for browser to build and launch properly
let driver = await new Builder().forBrowser("chrome").build();
try {
//To go to the test website from the browser with our code.
await driver.get("http://demo.automationtesting.in/FileDownload.html");
//To enter data inside the text area
await driver
@SarahElson
SarahElson / testOne.js
Last active September 15, 2022 09:30
Add the function call
const { By, Key, Builder } = require("selenium-webdriver");
require("chromedriver");
async function example() {
//To wait for browser to build and launch properly
let driver = await new Builder().forBrowser("chrome").build();
try {
//To go to the test website from the browser with our code.
await driver.get("http://demo.automationtesting.in/FileDownload.html");
@SarahElson
SarahElson / testTwo.js
Last active September 15, 2022 09:31
How To Download Files Using JavaScript and Selenium
const { By, Key, Builder } = require("selenium-webdriver");
require("chromedriver");
const chromeDriver = require("selenium-webdriver/chrome");
const webdriver = require("selenium-webdriver");
async function example() {
//To set chromeOptions
var options = new chromeDriver.Options();
options.setUserPreferences({
@SarahElson
SarahElson / testThree.js
Last active September 15, 2022 09:31
Download files using JavaScript and cloud Selenium Grid
const USERNAME = "YOUR_USERNAME"; //replace with your username
const KEY = "YOUR_ACCESSKEY"; //replace with your accesskey
const GRID_HOST = "hub.lambdatest.com/wd/hub";
const { By, Key, Builder } = require("selenium-webdriver");
async function example() {
var capabilities = {
@SarahElson
SarahElson / JobRoles.vue
Created July 7, 2022 14:49
Getting Started With Nuxt Testing [A Beginner’s Guide]
<template>
<li>
<nuxt-link :to="link" class="block hover:bg-gray-50">
<div class="px-4 py-4 sm:px-6">
<div class="flex items-center justify-between">
<p class="text-md font-medium text-blue-500 truncate">
{{ title }}
</p>
<div class="ml-2 flex-shrink-0 flex">
<p class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
@SarahElson
SarahElson / JobRoles.vue
Last active September 15, 2022 09:54
Getting Started With Nuxt Testing [A Beginner’s Guide]
pages/index.vue
<template>
<div class="max-w-sm mx-auto mt-8">
<div>
<h2 class="text-xl">
Job Board
</h2>
<span class="text-xs block pb-4">Awesome Jobs for awesome IT people</span>
</div>
<div class="shadow overflow-hidden sm:rounded-md">
@SarahElson
SarahElson / dropdown test.cs
Last active September 15, 2022 08:11
How To Select Dropdown In Selenium C#?
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.UI;
using System;
using OpenQA.Selenium.Remote;
namespace SeleniumTutorial
{
public class DropDown
{
@SarahElson
SarahElson / Dropdown parallel.cs
Last active September 15, 2022 08:14
How To Select Dropdown In Selenium C#?
[Test]
[TestCase("Monday")]
[TestCase("Tuesday")]
[TestCase("Wednesday")]
[TestCase("Thursday")]
[TestCase("Friday")]
[TestCase("Saturday")]
[TestCase("Sunday")]
[Parallelizable(ParallelScope.All)]
public void ValidateDropDownSelection(string dayOfTheWeek)
@SarahElson
SarahElson / Multiple select in Selenium C#.cs
Last active September 15, 2022 08:15
How To Select Dropdown In Selenium C#?
[Test]
public void ValidateMultipleSelection()
{
driver.Navigate().GoToUrl("https://www.lambdatest.com/selenium-playground/select-dropdown-demo");
string[] selectedStates = { "Florida", "New York", "Texas" };
var multiSelect = new SelectElement(driver.FindElement(By.Id("multi-select")));
Assert.IsTrue(multiSelect.IsMultiple, "The Select does not allow multiple selection.");
foreach (var state in selectedStates)
{
multiSelect.SelectByText(state);