Please provide us the code samples right through from instantiating AppiumDriver to quitting the driver.
Or Suggest some changes in the below code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Appium.Android;
using OpenQA.Selenium.Support.UI;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
DesiredCapabilities Usercapabilities;
Usercapabilities = new DesiredCapabilities();
Usercapabilities.SetCapability("deviceName", "Nexus 7");
Usercapabilities.SetCapability("platformName", "Android");
Usercapabilities.SetCapability("platformVersion", "5.0.2");
Usercapabilities.SetCapability(CapabilityType.BrowserName, "Chrome");
AppiumDriver driver = new AppiumDriver(new Uri("http://127.0.0.1:4723/wd/hub"), Usercapabilities);
driver.Navigate().GoToUrl("https://jobs.adp.com");
System.Threading.Thread.Sleep(7000);
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(12));
By txt_keywordSearch = By.Name("k");
By btn_Search = By.XPath("//button[contains(@id,'search-submit')]");
By section_Searchresults = By.Id("search-results");
//driver.FindElement(By.XPath("//a[contains(@data-callout-action,'job matching')]")).Click();
if (driver.FindElement(txt_keywordSearch).Displayed)
{
driver.FindElement(txt_keywordSearch).SendKeys("Manager");
driver.FindElement(btn_Search).Click();
System.Threading.Thread.Sleep(4000);
if (driver.FindElement(section_Searchresults).Displayed)
{
Console.WriteLine("successfully Navigated to search results page");
}
else {
Console.WriteLine("Did not Navigate to search results page");
}
}
}
}
}
Thanks in Advance