selenium visual studio c++ code example
Example: c++ with visual studio selenium webdriver
using System;using Microsoft.VisualStudio.TestTools.UnitTesting;using OpenQA.Selenium;using OpenQA.Selenium.Firefox;using OpenQA.Selenium.Chrome;using OpenQA.Selenium.Support.UI; namespace SeleniumWebDevTesting{ [TestClass] public class TestSelenium { static IWebDriver driverFF; static IWebDriver driverGC; [AssemblyInitialize] public static void SetUp (TestContext context) { driverFF = new FirefoxDriver(); driverGC = new ChromeDriver(); } [TestMethod] public void TestChromeDriver() { driverGC.Navigate().GoToUrl("http://www.google.com/"); driverGC.FindElement(By.Id("lst-ib")) .SendKeys("Tapas Pal Codeguru"); driverGC.FindElement(By.Id("lst-ib")) .SendKeys(Keys.Enter); } [TestMethod] public void TestFireFoxDriver() { driverGC.Navigate().GoToUrl("http://www.google.com/"); driverGC.FindElement(By.Id("lst-ib")) .SendKeys("Tapas Pal Codeguru"); driverGC.FindElement(By.Id("lst-ib")) .SendKeys(Keys.Enter); } }}