using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Support.UI;
namespace AshuPractice
{
[TestClass]
public class UnitTest1
{
IWebDriver driver1;
[TestMethod]
public void TestMethod1()
{
// Open the browser for Automation
IWebDriver driver = new ChromeDriver();
driver.Manage().Window.Maximize();
// WebPage which contains a WebTable
driver.Navigate().GoToUrl("https://www.toolsqa.com/automation-practice-form/?firstname=&lastname=&sex=Male&exp=1&photo=&continents=Asia&submit=");
//driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(30));
//driver.Manage().Timeouts().
Thread.Sleep(5000);
// Below code is for scrolling
var element = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div/div/div/div[2]/div/form/fieldset/div[29]"));
Actions actions = new Actions(driver);
actions.MoveToElement(element);
actions.Perform();
//Below code is for uploading
(driver.FindElement(By.XPath("//*[@id='photo']"))).Click();
Thread.Sleep(5000);
SendKeys.SendWait("C:\\Users\\asamantr\\OneDrive - Itron\\Desktop\\New folder\\New Text Document.txt");
SendKeys.SendWait(@"{Enter}"); //NameSpace using System.Windows.Forms
Thread.Sleep(5000);
driver.Quit();
}
}
}
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Interactions;
using OpenQA.Selenium.Support.UI;
namespace AshuPractice
{
[TestClass]
public class UnitTest1
{
IWebDriver driver1;
[TestMethod]
public void TestMethod1()
{
// Open the browser for Automation
IWebDriver driver = new ChromeDriver();
driver.Manage().Window.Maximize();
// WebPage which contains a WebTable
driver.Navigate().GoToUrl("https://www.toolsqa.com/automation-practice-form/?firstname=&lastname=&sex=Male&exp=1&photo=&continents=Asia&submit=");
//driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(30));
//driver.Manage().Timeouts().
Thread.Sleep(5000);
// Below code is for scrolling
var element = driver.FindElement(By.XPath("//*[@id='content']/div[1]/div/div/div/div[2]/div/form/fieldset/div[29]"));
Actions actions = new Actions(driver);
actions.MoveToElement(element);
actions.Perform();
//Below code is for uploading
(driver.FindElement(By.XPath("//*[@id='photo']"))).Click();
Thread.Sleep(5000);
SendKeys.SendWait("C:\\Users\\asamantr\\OneDrive - Itron\\Desktop\\New folder\\New Text Document.txt");
SendKeys.SendWait(@"{Enter}"); //NameSpace using System.Windows.Forms
Thread.Sleep(5000);
driver.Quit();
}
}
}
No comments:
Post a Comment