Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions src/Appium.Net/Appium.Net.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/Appium.Net/Appium/AppiumDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace OpenQA.Selenium.Appium
public abstract class AppiumDriver : WebDriver,
IHasSessionDetails,
IHasLocation,
IHidesKeyboard, IInteractsWithFiles, IFindsByFluentSelector<AppiumWebElement>,
IHidesKeyboard, IInteractsWithFiles, IFindsByFluentSelector<AppiumElement>,
IInteractsWithApps, IPerformsTouchActions, IRotatable, IContextAware
{
private const string NativeApp = "NATIVE_APP";
Expand Down Expand Up @@ -97,16 +97,16 @@ Response IExecuteMethod.Execute(string commandName, Dictionary<string, object> p

#region Generic FindMethods

public new AppiumWebElement FindElement(By by) =>
(AppiumWebElement)base.FindElement(by);
public new AppiumElement FindElement(By by) =>
(AppiumElement)base.FindElement(by);

public new ReadOnlyCollection<AppiumWebElement> FindElements(By by) =>
ConvertToExtendedWebElementCollection<AppiumWebElement>(base.FindElements(by));
public new ReadOnlyCollection<AppiumElement> FindElements(By by) =>
ConvertToExtendedWebElementCollection<AppiumElement>(base.FindElements(by));

public new AppiumWebElement FindElement(string by, string value) => (AppiumWebElement)base.FindElement(by, value);
public new AppiumElement FindElement(string by, string value) => (AppiumElement)base.FindElement(by, value);

public new IReadOnlyCollection<AppiumWebElement> FindElements(string selector, string value) =>
ConvertToExtendedWebElementCollection<AppiumWebElement>(base.FindElements(selector, value));
public new IReadOnlyCollection<AppiumElement> FindElements(string selector, string value) =>
ConvertToExtendedWebElementCollection<AppiumElement>(base.FindElements(selector, value));
#endregion Generic FindMethods

Response IExecuteMethod.Execute(string driverCommand) => Execute(driverCommand, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace OpenQA.Selenium.Appium
{
/// <summary>
/// AppiumWebElement allows you to have access to specific items that are found on the page.
/// AppiumElement allows you to have access to specific items that are found on the page.
/// </summary>
/// <seealso cref="IWebElement"/>
/// <seealso cref="ILocatable"/>
Expand All @@ -33,19 +33,19 @@ namespace OpenQA.Selenium.Appium
/// public void TestGoogle()
/// {
/// driver = new AppiumDriver();
/// AppiumWebElement elem = driver.FindElement(By.Name("q"));
/// AppiumElement elem = driver.FindElement(By.Name("q"));
/// elem.SendKeys("Cheese please!");
/// }
/// </code>
/// </example>
public class AppiumWebElement : WebElement, IFindsByFluentSelector<AppiumWebElement>, IWebElementCached
public class AppiumElement : WebElement, IFindsByFluentSelector<AppiumElement>, IWebElementCached
{
/// <summary>
/// Initializes a new instance of the AppiumWebElement class.
/// Initializes a new instance of the AppiumElement class.
/// </summary>
/// <param name="parent">Driver in use.</param>
/// <param name="id">ID of the element.</param>
public AppiumWebElement(WebDriver parent, string id)
public AppiumElement(WebDriver parent, string id)
: base(parent, id)
{
}
Expand Down Expand Up @@ -207,19 +207,19 @@ public void SetImmediateValue(string value) => Execute(AppiumDriverCommand.SetVa

public Response Execute(string driverCommand) => Execute(driverCommand, null);

AppiumWebElement IFindsByFluentSelector<AppiumWebElement>.FindElement(string by, string value)
AppiumElement IFindsByFluentSelector<AppiumElement>.FindElement(string by, string value)
{
return (AppiumWebElement)base.FindElement(by, value);
return (AppiumElement)base.FindElement(by, value);
}

IReadOnlyCollection<AppiumWebElement> IFindsByFluentSelector<AppiumWebElement>.FindElements(string selector, string value)
IReadOnlyCollection<AppiumElement> IFindsByFluentSelector<AppiumElement>.FindElements(string selector, string value)
{
return ConvertToExtendedWebElementCollection(base.FindElements(selector, value));
}

internal static ReadOnlyCollection<AppiumWebElement> ConvertToExtendedWebElementCollection(IEnumerable collection)
internal static ReadOnlyCollection<AppiumElement> ConvertToExtendedWebElementCollection(IEnumerable collection)
{
return collection.Cast<AppiumWebElement>().ToList().AsReadOnly();
return collection.Cast<AppiumElement>().ToList().AsReadOnly();
}

public new string Id => base.Id;
Expand Down
6 changes: 3 additions & 3 deletions src/Appium.Net/Appium/AppiumElementFactory.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

namespace OpenQA.Selenium.Appium
{
public class AppiumElementFactory : CachedElementFactory<AppiumWebElement>
public class AppiumElementFactory : CachedElementFactory<AppiumElement>
{
public AppiumElementFactory(WebDriver parentDriver) : base(parentDriver)
{
}

protected override AppiumWebElement CreateCachedElement(WebDriver parentDriver, string elementId)
protected override AppiumElement CreateCachedElement(WebDriver parentDriver, string elementId)
{
return new AppiumWebElement(parentDriver, elementId);
return new AppiumElement(parentDriver, elementId);
}
}
}
9 changes: 9 additions & 0 deletions src/Appium.Net/Appium/AppiumOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public AppiumOptions() : base()
/// </summary>
public string PlatformVersion { get; set; }

/// <summary>
/// Gets or sets the Browser name of the Appium browser's (e.g. Chrome, Safari and so on) setting.
/// </summary>
public new string BrowserName
{
get { return base.BrowserName; }
set { base.BrowserName = value; }
}

/// <summary>
/// Provides a means to add additional capabilities not yet added as type safe options
/// for the Appium driver.
Expand Down
4 changes: 1 addition & 3 deletions test/integration/Android/ConnectionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ class ConnectionTest
[OneTimeSetUp]
public void BeforeAll()
{
var capabilities = Env.ServerIsRemote()
? Caps.GetAndroidUIAutomatorCaps(Apps.Get("androidApiDemos"))
: Caps.GetAndroidUIAutomatorCaps(Apps.Get("androidApiDemos"));
var capabilities = Caps.GetAndroidUIAutomatorCaps(Apps.Get("androidApiDemos"));
var serverUri = Env.ServerIsRemote() ? AppiumServers.RemoteServerUri : AppiumServers.LocalServiceUri;
_driver = new AndroidDriver(serverUri, capabilities, Env.InitTimeoutSec);
_driver.Manage().Timeouts().ImplicitWait = Env.ImplicitTimeoutSec;
Expand Down
39 changes: 39 additions & 0 deletions test/integration/Android/Device/BrowserTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Appium.Net.Integration.Tests.helpers;
using NUnit.Framework;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Android;
using System;

namespace Appium.Net.Integration.Tests.Android.Device.App
{
internal class BrowserTests
{
private AppiumDriver _driver;
private AppiumOptions _androidOptions;

[OneTimeSetUp]
public void SetUp()
{
_androidOptions = new AppiumOptions();
_androidOptions.BrowserName = "Chrome";

_driver = new AndroidDriver(
Env.ServerIsLocal() ? AppiumServers.LocalServiceUri : AppiumServers.RemoteServerUri,
_androidOptions);
_driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
}

[OneTimeTearDown]
public void TearDown()
{
_driver.Dispose();
}

[Test]
public void Browser()
{
_driver.Navigate().GoToUrl("https://github.com/appium");
Assert.IsNotEmpty(_driver.PageSource);
}
}
}
8 changes: 4 additions & 4 deletions test/integration/Android/TouchActionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void AfterAll()
[Test]
public void SimpleTouchActionTestCase()
{
IList<AppiumWebElement> els = _driver.FindElements(MobileBy.ClassName("android.widget.TextView"));
IList<AppiumElement> els = _driver.FindElements(MobileBy.ClassName("android.widget.TextView"));

var number1 = els.Count;

Expand All @@ -65,7 +65,7 @@ public void SimpleTouchActionTestCase()
[Test]
public void ComplexTouchActionTestCase()
{
IList<AppiumWebElement> els = _driver.FindElements(MobileBy.ClassName("android.widget.TextView"));
IList<AppiumElement> els = _driver.FindElements(MobileBy.ClassName("android.widget.TextView"));
var loc1 = els[7].Location;
var target = els[1];
var loc2 = target.Location;
Expand All @@ -78,7 +78,7 @@ public void ComplexTouchActionTestCase()
[Test]
public void SingleMultiActionTestCase()
{
IList<AppiumWebElement> els = _driver.FindElements(MobileBy.ClassName("android.widget.TextView"));
IList<AppiumElement> els = _driver.FindElements(MobileBy.ClassName("android.widget.TextView"));
var loc1 = els[7].Location;
var target = els[1];
var loc2 = target.Location;
Expand All @@ -97,7 +97,7 @@ public void SingleMultiActionTestCase()
public void SequentalMultiActionTestCase()
{
var originalActivity = _driver.CurrentActivity;
IList<AppiumWebElement> els = _driver.FindElements(MobileBy.ClassName("android.widget.TextView"));
IList<AppiumElement> els = _driver.FindElements(MobileBy.ClassName("android.widget.TextView"));
var multiTouch = new MultiAction(_driver);

var tap1 = new TouchAction(_driver);
Expand Down
Loading