我如何找出要用于我的 If 语句的内容。当我想识别我正在使用 Browserstack
How do i figure out what to use for my If statement. When I want to identify I am using Browserstack
Browserstack 使用此 uri http:/hub-cloud.browserstack.com/wd/hub。在本地我使用 http://xxx.xxx.xx.xxx:xxxx/wd/hub。我尝试将它们放入,但出现错误我还尝试使用 Browserstack(这是 Browserstack 设置代码)获取 FI 的布尔值,所以我在下面有以下内容。 if (Location)
中应该包含什么
if (Location)
{
var foundElement = (_IOSdriver.FindElementsByXPath(elementXPath));
Assert.IsNotNull(foundElement);
// Browserstack Check;
}
else
{
IReadOnlyList<IOSElement> allTextViewElements =
_IOSdriver.FindElementsByXPath(elementXPath);
//Setting the status of test as 'passed' or 'failed' based on the condition if results are found for the search
if ((allTextViewElements.Count > 0))
{
((IJavaScriptExecutor)_IOSdriver).ExecuteScript("browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"passed\", \"reason\": \" Results found! \"}}");
}
else
{
((IJavaScriptExecutor)_IOSdriver).ExecuteScript("browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"failed\", \"reason\": \" Results not found!\"}}");
}
答案是添加
var isbrowserstackrunning =false;
if (isBrowserstackrunning !=true)
{local stuff here including the capabilities you use locally}
else
{BrowserStack here including the capabilities you use for Browserstack.}
Browserstack 使用此 uri http:/hub-cloud.browserstack.com/wd/hub。在本地我使用 http://xxx.xxx.xx.xxx:xxxx/wd/hub。我尝试将它们放入,但出现错误我还尝试使用 Browserstack(这是 Browserstack 设置代码)获取 FI 的布尔值,所以我在下面有以下内容。 if (Location)
中应该包含什么if (Location)
{
var foundElement = (_IOSdriver.FindElementsByXPath(elementXPath));
Assert.IsNotNull(foundElement);
// Browserstack Check;
}
else
{
IReadOnlyList<IOSElement> allTextViewElements =
_IOSdriver.FindElementsByXPath(elementXPath);
//Setting the status of test as 'passed' or 'failed' based on the condition if results are found for the search
if ((allTextViewElements.Count > 0))
{
((IJavaScriptExecutor)_IOSdriver).ExecuteScript("browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"passed\", \"reason\": \" Results found! \"}}");
}
else
{
((IJavaScriptExecutor)_IOSdriver).ExecuteScript("browserstack_executor: {\"action\": \"setSessionStatus\", \"arguments\": {\"status\":\"failed\", \"reason\": \" Results not found!\"}}");
}
答案是添加
var isbrowserstackrunning =false;
if (isBrowserstackrunning !=true)
{local stuff here including the capabilities you use locally}
else
{BrowserStack here including the capabilities you use for Browserstack.}