Skip to content

Instantly share code, notes, and snippets.

View angelovstanton's full-sized avatar
💭
UPDATED STATUS

Anton Angelov angelovstanton

💭
UPDATED STATUS
View GitHub Profile
[TestMethod]
public void JavaScripPopUps()
{
this.driver.Navigate().GoToUrl(
@"http://www.w3schools.com/js/tryit.asp?filename=tryjs_confirm");
this.driver.SwitchTo().Frame("iframeResult");
IWebElement button = driver.FindElement(By.XPath("/html/body/button"));
button.Click();
IAlert a = driver.SwitchTo().Alert();
if (a.Text.Equals("Press a button!"))
[TestMethod]
public void DragAndDrop()
{
this.driver.Navigate().GoToUrl(@"http://loopj.com/jquery-simple-slider/");
IWebElement element = driver.FindElement(By.XPath("//*[@id='project']/p[1]/div/div[2]"));
Actions move = new Actions(driver);
move.DragAndDropToOffset(element, 30, 0).Perform();
}
// <copyright file="BlobStorageService.cs" company="Automate The Planet Ltd.">
// Copyright 2021 Automate The Planet Ltd.
// Unauthorized copying of this file, via any medium is strictly prohibited
// Proprietary and confidential
// </copyright>
// <author>Anton Angelov</author>
// <site>https://bellatrix.solutions/</site>
using System;
using System.Collections.Generic;
using System;
public class Program
{
public static void Main()
{
Console.WriteLine("Hello Sukhpinder!");
}
}
function genScreenshot() {
var canvasImgContentDecoded;
html2canvas(document.body, {
onrendered: function(canvas) {
window.canvasImgContentDecoded = canvas.toDataURL("image/png");
}
});
}
genScreenshot();
SelectElement selectElement = new SelectElement(driver.FindElement(By.XPath("/html/body/select")));
selectElement.SelectByText("Planet");
IWebDriver firefoxDriver = new FirefoxDriver();
IWebDriver ieDriver = new InternetExlorerDriver();
IWebDriver edgeDriver = new EdgeDriver();
IWebDriver chromeDriver = new ChromeDriver();
[TestMethod]
public void OrderDateSortAsc()
{
this.driver.Navigate().GoToUrl(
@"http://demos.telerik.com/kendo-ui/grid/remote-data-binding");
var kendoGrid = new KendoGrid(this.driver, this.driver.FindElement(By.Id("grid")));
var allItems = this.GetAllItemsFromDb().OrderBy(x => x.OrderDate);
var lastOrderDate = allItems.First().OrderDate;
ProfilesIni profile = new ProfilesIni();
FirefoxProfile firefoxProfile = profile.getProfile("xyzProfile");
String downloadFilepath = "c:\\temp";
firefoxProfile.setPreference("browser.download.folderList", 2);
firefoxProfile.setPreference("browser.download.dir", downloadFilepath);
firefoxProfile.setPreference("browser.download.manager.alertOnEXEOpen", false);
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk",
"application/msword, application/binary, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-stream"));
FirefoxOptions firefoxOptions = new FirefoxOptions();
@Test
public void VerifyFileDownloadChrome() throws IOException {
var expectedFilePath = Paths.get("c:\\temp\\Testing_Framework_2015_3_1314_2_Free.exe");
try
{
driver.navigate().to("https://www.telerik.com/download-trial-file/v2/telerik-testing-framework");
wait.until(x -> Files.exists(expectedFilePath));
long bytes = Files.size(expectedFilePath);
Assert.assertEquals(4326192, bytes);