我在mac上运行appium并在另一台机器上运行代码。一切都很好,这是打开模拟器等。但是我的测试仍然失败,因为它从未进入测试。下面的驱动程序变量的计算结果为null,并且它不会提取它。你能帮忙吗
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium.Appium.iOS;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Enums;
using System.Threading;
using OpenQA.Selenium.Support.UI;
namespace AutoItX_Testing
{
[TestFixture]
class IOSDemo
{
public IOSDriver<IOSElement> driver;
// public IWebDriver driver;
[SetUp]
public void Start()
{
//Setting Capabilities
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.SetCapability(MobileCapabilityType.PlatformVersion, "10.1");
//capabilities.SetCapability("platform", "Mac");
// capabilities.SetCapability("deviceName", "iPhone 6");
capabilities.SetCapability(MobileCapabilityType.DeviceName, "iPhone 6");
capabilities.SetCapability(MobileCapabilityType.AutomationName, "XCUITest");
capabilities.SetCapability(IOSMobileCapabilityType.BundleId, "com.softworks.selfservice.app");
//capabilities.SetCapability("native-instruments-lib", true);
//capabilities.SetCapability("deviceReadyTimeout",100000);
// capabilities.SetCapability("deviceReadyTimeout", "100000");
// capabilities.SetCapability("newCommandTimeout", "18000000000000");
// capabilities.SetCapability("newCommandTimeout", 18000000000000);
capabilities.SetCapability(MobileCapabilityType.PlatformName, "IOS");
capabilities.SetCapability(IOSMobileCapabilityType.LocationServicesEnabled, "false");
capabilities.SetCapability(MobileCapabilityType.NewCommandTimeout, "900000");
capabilities.SetCapability(MobileCapabilityType.NewCommandTimeout, 900000);
capabilities.SetCapability(IOSMobileCapabilityType.LaunchTimeout, "50000");
capabilities.SetCapability(IOSMobileCapabilityType.LaunchTimeout, 50000);
capabilities.SetCapability(IOSMobileCapabilityType.NativeInstrumentsLib, true);
// capabilities.SetCapability(MobileCapabilityType.App, "/Users/itsoftworks/Desktop/UICatalog7/UICatalog.app");
capabilities.SetCapability(MobileCapabilityType.App, "/Users/itsoftworks/Desktop/SelfService/Self Service.app");
driver = new IOSDriver<IOSElement>(
new Uri("http://192.168.17.85:4723/wd/hub"),
capabilities);
while (driver ==null)
{
Thread.Sleep(5000);
Console.WriteLine("driver is still null");
}
// driver = new RemoteWebDriver(new Uri("http://192.168.17.85:4723/wd/hub"),capabilities);
// Thread.Sleep(1000000000);
// driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(1000000));
}
[Test]
public void VerifyMenuSimulator()
{
//Test to login into app
Thread.Sleep(100);
Console.WriteLine("it worked"); ;
//driver.manage().Timeouts().ImplicitlyWait(Timespan.FromSeconds(60));
//driver.FindElement(By.XPath("//UIATextField[1]")).SendKeys("username");
// driver.FindElement(By.XPath("///UIASecureTextField[1]")).SendKeys("password");
// driver.FindElement(By.XPath("///UIAButton[1]")).Click();
}
[TearDown]
public void Cleanup()
{
driver.Quit();
}
}
}