mercredi 15 janvier 2020

Android Mobile testing with Appium Selenium C#

I have tried a lot of different stuff from the google and you-tube and this is where i land and i cannot get it to work, my connection to the Appium and emulator is fine also i have checked the adb devices everything is fine.

I am getting error for the Line driver = new AndroidDriver<IWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), cap, TimeSpan.FromSeconds(180));

These are the two errors which i get:

"cannot convert from 'System.Uri' to 'OpenQA.Selenium.Appium.Service.AppiumServiceBuilder'"

and

"cannot convert from 'OpenQA.Selenium.Remote.DesiredCapabilities' to 'OpenQA.Selenium.DriverOptions".

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Appium.Enums;
using OpenQA.Selenium.Appium.Android;

namespace UnitTestProject4
{
    [TestClass]
    public class UnitTest1
    {
        AppiumDriver<IWebElement> driver;
 [TestMethod]
    public void TestMethod1()
    {
        DesiredCapabilities cap = new DesiredCapabilities();
        cap.SetCapability("deviceName", "Pixel 3a Pie 9.0 - API 28");
        cap.SetCapability("platformVersion", "9.0");
        cap.SetCapability("udid", "emulator-5554");
        cap.SetCapability("appPackage", "org.mozilla.firefox");
        cap.SetCapability("appActivity", "org.mozilla.gecko.BrowserApp");
        cap.SetCapability("platformName", "Android");
        driver = new AndroidDriver<IWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), cap, TimeSpan.FromSeconds(180));
        driver.Navigate().GoToUrl("https://www.google.com");

      }
   }
 }

Aucun commentaire:

Enregistrer un commentaire