Invalid Operation Exception in C# Unit Test using Protractor - c#

I have a simple test class like this:
public class MyTest
{
const string URL = "https://example.com/content/mypage.aspx";
IWebDriver driver;
NgWebDriver ngDriver;
[SetUp]
public void Setup()
{
driver = new ChromeDriver();
driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));
ngDriver = new NgWebDriver(driver);
}
[TearDown]
public void Teardown()
{
ngDriver.Quit();
}
[Test]
public void Basic()
{
ngDriver.Url = URL;
Assert.IsTrue(ngDriver.FindElement(By.CssSelector("#my")).Displayed);
}
}
and here's the HTML snippet:
<kendo-button id="my" ng-click="myCtrl.doSomething()">Do Something</kendo-button>
I'm getting the following error on the Assert.IsTrue line:
javascript error: [ng:test] http://errors.angularjs.org/1.3.15/ng/test
JavaScript stack:
Error: [ng:test] http://errors.angularjs.org/1.3.15/ng/test
at Error (native)
at https://example.com/AngularJS/1.3.15/angular.min.js:6:417
at Object.Ld [as getTestability] (https://example.com/AngularJS/1.3.15/angular.min.js:18:468)
at eval (eval at executeAsyncScript (unknown source), <anonymous>:10:13)
at eval (eval at executeAsyncScript (unknown source), <anonymous>:18:5)
at executeAsyncScript (<anonymous>:329:26)
at <anonymous>:345:29
at callFunction (<anonymous>:237:33)
at <anonymous>:247:23
at <anonymous>:248:3
(Session info: chrome=49.0.2623.87)
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64) (UnexpectedJavaScriptError)
and the stack trace is:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScriptCommand(String script, String commandName, Object[] args)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteAsyncScript(String script, Object[] args)
at Protractor.NgWebDriver.WaitForAngular() in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:line 315
at Protractor.NgWebDriver.FindElement(By by) in c:\Users\Bruno\Projets\GitHub\bbaia\protractor-net\src\Protractor\NgWebDriver.cs:line 262
I only got the Protractor and Selenium WebDriver Nuget package. Is there something else I need to install or this is actually a code problem?

You're not actually navigating to the URL before the Assert?
Try -
[Test]
public void Basic()
{
NgDriver.Navigate().GoToUrl(URL);
Assert.IsTrue(ngDriver.FindElement(By.CssSelector("#my")).Displayed);
}

Building on what I shared below, I found that my problem was not specifying the root to the document. In my tag, I had
data-ng-app='myApp'
The code to create my protractor driver was:
ngDriver = new NgWebDriver(driver, "[ng-data='myApp']"
Protractor-net doesn't modify this direct CSS search criteria, so what worked was:
ngDriver = new NgWebDriver(driver, "[data-ng-app='myApp']"
Not an answer, but I don't have the ability to comment.
I'm seeing the same issue. Further investigation reveals that there is an exception being thrown when the NgWebDriver is instantiated. Inspecting the object shows the Location, PageSource, Title and Url members of the object created all "threw an exception of type 'System.InvalidOperationException' string {System.InvalidOperationException}". The exception only gets thrown up to the test when attempting to find an element.
My code looks like:
public DefaultPOM(IWebDriver webDriver, string baseURL)
{
driver = webDriver;
this.baseURL = baseURL;
driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));
driver.Navigate().GoToUrl(baseURL);
ngDriver = new NgWebDriver(driver, "[ng-app='myApp']");
ngDriver.Manage().Window.Maximize();
ngDriver.Navigate().GoToUrl(baseURL);
}
The inspecting the ngDriver object right after it is created shows the exceptions.
If I turn off synchronization before navigating, the only member of the driver object recording the exception is the Location.
ngDriver = new NgWebDriver(driver, "[ng-app='NCTWebPortal']");
ngDriver.IgnoreSynchronization=true;
ngDriver.Manage().Window.Maximize();
ngDriver.Navigate().GoToUrl(baseURL);
ngDriver.IgnoreSynchronization = false;

Related

Selenium C# waiting for page to load - UnexpectedJavaScriptError

I am using selenium, IEDriver, and C# and I would like to wait for the page to load. I have this code:
/// <summary>
/// Ceka dokud neni stranka nastena
/// </summary>
public static void WaitForPageToLoad()
{
try
{
Thread.Sleep(500);
Log.Trace("Browser.WaitForPageToLoad() - Ceka dokud neni stranka nactena ...");
new WebDriverWait(Browser.Driver, new TimeSpan(0, 0, 360)).Until(d => ((IJavaScriptExecutor)d).ExecuteScript("return document.readyState").Equals("complete"));
Thread.Sleep(1000);
}
catch (Exception ex)
{
Log.Error(ex);
throw;
}
}
but it will crash on this:
2018-01-04 15:39:27.2266 - ERROR: System.InvalidOperationException: JavaScript error (UnexpectedJavaScriptError)
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScriptCommand(String script, String commandName, Object[] args)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScript(String script, Object[] args)
at BaseFramework.Browser.<>c.<WaitForPageToLoad>b__10_0(IWebDriver d) in C:\TFS\PRIVPMT\Selenium\BaseFramework\Browser.cs:line 97
at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
at BaseFramework.Browser.WaitForPageToLoad() in C:\TFS\PRIVPMT\Selenium\BaseFramework\Browser.cs:line 97
EXCEPTION: System.InvalidOperationException: JavaScript error (UnexpectedJavaScriptError)
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScriptCommand(String script, String commandName, Object[] args)
at OpenQA.Selenium.Remote.RemoteWebDriver.ExecuteScript(String script, Object[] args)
at BaseFramework.Browser.<>c.<WaitForPageToLoad>b__10_0(IWebDriver d) in C:\TFS\PRIVPMT\Selenium\BaseFramework\Browser.cs:line 97
at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
at BaseFramework.Browser.WaitForPageToLoad() in C:\TFS\PRIVPMT\Selenium\BaseFramework\Browser.cs:line 103
at Gamma.Tests.GammaICRM.AT82688_ICRM_SMOKE() in C:\TFS\PRIVPMT\Selenium\Gamma.UI.Tests\Gamma.Tests\GammaICRM.cs:line 72
at Gamma.Tests.GammaICRM.AT82688_ICRM_SMOKE_PerformTest() in C:\TFS\PRIVPMT\Selenium\Gamma.UI.Tests\Gamma.Tests\GammaICRM.cs:line 23
most of the time it works, but from time to time it will crash on this
next method is this:
public static void LeftClick(this IWebElement element)
{
//pockame dokud nelze na element kliknout
new WebDriverWait(Browser.Driver, new TimeSpan(0, 0, 120)).Until(ExpectedConditions.ElementToBeClickable(element));
Actions actions = new Actions(Browser.Driver);
//posuneme cursor na element
actions.MoveToElement(element).Perform();
//klikeneme na element
actions.Click().Build().Perform();
}
passed webElement is founded by XPath (webElement is always correct)
You could try calling the WebDriverWait class. You can use this to wait for an element to show up on the page (i.e the page loads if this object exists)
public static IWebElement WaitUntilElementExists(By elementLocator, int timeout = 10)
{
try
{
var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(timeout));
return wait.Until(ExpectedConditions.ElementExists(elementLocator));
}
catch (NoSuchElementException)
{
Console.WriteLine("Element with locator: '" + elementLocator + "' was not found in current context page.");
throw;
}
}
In this code the method returns wait.until then the elementexists condition on an element that is supposed to be on the page. Just have it try to find an element on the page which is supposed to be there when the page loads. If it doesn't exist for a certain amount of time it will give the NoSuchElementException (so a timeout). Catch this and give your own output
source: How to get webDriver to wait for page to load (C# Selenium project)
hope this helps at all
I've faced the same issue and the problem was that I was inside of a frame. Switching back to default content before executing this javascript resolved the error.
Hope it'll help if the problem is still valid for you.
In one word, just before calling WaitForPageToLoad() I've used _driver.SwitchTo().DefaultContent();

Dependency Resolution Exception

I am doing Unit Testing In my Project.When I try to unit test my method a browser pops up and suddenly gets stopped after that I get a long exception I pasted following.
How to fix this mess as I have no idea whats the cause?
Exception:
https://paste.ubuntu.com/24389202/
BrowseHost Class
public static class BrowserHost
{
public static readonly SelenoHost Instance = new SelenoHost();
public static readonly String RootUrl;
static BrowserHost()
{
Instance.Run("BankingSite", 1468);
RootUrl= Instance.Application.Browser.Url;
}
}
UnitTest Class
namespace BankingSite.FunctionalUITests
{
[TestFixture]
public class LoanApplicationTest
{
[Test]
public void ShouldAcceptLoanApplication()
{
BrowserHost.Instance
.Application.Browser
.Navigate()
.GoToUrl($#"{BrowserHost.RootUrl}\LoanApplication\Apply");
var firstNameBox = BrowserHost.Instance.Application
.Browser
.FindElement(By.Id("FirstName"));
firstNameBox.SendKeys("Gentry");
var lastNameBox = BrowserHost.Instance.
Application.
Browser.
FindElement(By.Id("LastName"));
lastNameBox.SendKeys("Smith");
var ageBox = BrowserHost.Instance
.Application
.Browser
.FindElement(By.Id("Age"));
ageBox.SendKeys("40");
var incomeBox = BrowserHost.Instance
.Application
.Browser
.FindElement(By.Id("AnnualIncome"));
incomeBox.SendKeys("9999999");
Thread.Sleep(10000);
var applyButton = BrowserHost.Instance
.Application
.Browser
.FindElement(By.Id("Applt"));
applyButton.Click();
Thread.Sleep(10000);
var acceptMessageText = BrowserHost.Instance
.Application
.Browser
.FindElement(By.Id("acceptMessage"));
Assert.That(acceptMessageText, Is.EqualTo("Congratulations Gentry - Your Application was accepted!"));
Thread.Sleep(10000);
}
}
Following is the Screen Shot of URL I am browsing directly.
Hard to tell from what you've provided, but there is a clue in the stack trace:
System.TypeInitializationException : The type initializer for 'BankingSite.FunctionalUITests.BrowserHost' threw an exception.
----> Autofac.Core.DependencyResolutionException : An exception was thrown while executing a resolve operation. See the InnerException for details. ---> Not a Number (See inner exception for details.)
----> System.InvalidOperationException : Not a Number
Check the constructor for BankingSite.FunctionalUITests.BrowserHost and see if you can find the line that is causing the error. Apparently it is expecting a numeric value but received something else instead.

Take screenshot

I'm trying to take a screenshot on test failure.
[TearDown]
public void TearDown()
{
var status = TestContext.CurrentContext.Result.Outcome.Status;
var stackTrace = "<pre>" + TestContext.CurrentContext.Result.Message + "</pre>";
var errorMessage = TestContext.CurrentContext.Result.Message;
if (status == NUnit.Framework.Interfaces.TestStatus.Failed)
{
test.Log(LogStatus.Fail, status + errorMessage);
var ScreenShotPath = GetScreenShot.Capture(_webdriverChrome);
test.Log(LogStatus.Fail, "Screen Shot Below: "+test.AddScreenCapture(ScreenShotPath));
}
else if (status == NUnit.Framework.Interfaces.TestStatus.Passed)
{
test.Log(LogStatus.Pass, status + errorMessage);
}
extent.EndTest(test);
_webdriverChrome.Quit();}
and the capture function is
public static string Capture(IWebDriver Webdrievr)
{
string pth = System.Reflection.Assembly.GetCallingAssembly().CodeBase;
string actualPath = pth.Substring(0, pth.LastIndexOf("bin"));
string projectPath = new Uri(actualPath).LocalPath;
Screenshot ss = ((ITakesScreenshot)Webdrievr).GetScreenshot();
string screenshot = ss.AsBase64EncodedString;
byte[] screenshotAsByteArray = ss.AsByteArray;
ss.SaveAsFile(projectPath + "ErrorReportScreenshot\\ErrorScreenshot.jpeg", ScreenshotImageFormat.Jpeg); //use any of the built in image formating
string _fullPathToReturn = projectPath + "ErrorReportScreenshot";
return _fullPathToReturn;
}
I'm getting an error
Result Message:
OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:56184/session/1aaf976356898c52e5cd57d17d44df15/element timed out after 60 seconds.
----> System.Net.WebException : The operation has timed out
TearDown : OpenQA.Selenium.WebDriverException : The HTTP request to the remote WebDriver server for URL http://localhost:56184/session/1aaf976356898c52e5cd57d17d44df15/screenshot timed out after 60 seconds.
----> System.Net.WebException : The operation has timed out
The thing is that it fails taking the screenshots as long as I'm calling the capture() method from TearDown().
If I'm just calling the capture() by running it within a new test, it works like a charm.
In debugging mode, I can see it fails on this row: Screenshot ss = ((ITakesScreenshot)Webdrievr).GetScreenshot();
what am I missing?
EDIT:
I have watched the ((ITakesScreenshot)Webdrievr) and getting an error:
error CS0103: The name 'Webdrievr' does not exist in the current context
Call Stack:
> Assign_Represnt.dll!Assign_Represnt.GetScreenShot.Capture(OpenQA.Selenium.IWebDriver Webdrievr) Line 22 C#
I found the problem . for some reason the following caused all of this
var options = new ChromeOptions();
options.AddArgument("no-sandbox");
_webdriverChrome = new ChromeDriver(options);
I just used the chromedriver without options and it works now.
_webdriverChrome = new ChromeDriver();
I am having similar issue while trying to take screenshot upon test failure. I get timed out error when I try to take the screenshot on failure condition. It works fine in try block but timed out in catch block. I am not using Chrome options as the solution provided above. Any help would be appreciated.
Below is the method to take screenshot:
public class Logging
{
public static void ErrorScreenshot()
{
//Take the screenshot
Screenshot ssh = ((ITakesScreenshot)Driver.BrowserInstance).GetScreenshot();
//Save the screenshot
ssh.SaveAsFile("C:/Users/", ScreenshotImageFormat.Png);
}
}
This is my test method
public static bool FindElement
{
get
{
try
{
var element = Driver.BrowserInstance.FindElement(By.XPath(" "));
if (element != null)
{
return true;
}
}
catch (Exception ex)
{
Logging.ErrorScreenshot();
Logging.Error("Not able to find element" + ex.ToString());
}
return false;
}
}
when it is not able to find the element it goes to catch block and there Logging.ErrorScreenshot method throws a timed out exception.
Error details below:
OpenQA.Selenium.WebDriverException
HResult=0x80131500
Message=The HTTP request to the remote WebDriver server for URL http://localhost:55418/session/f3dbde1645dd91e453c5823d72199ea9/screenshot timed out after 60 seconds.
Source=WebDriver
StackTrace:
at OpenQA.Selenium.Remote.HttpCommandExecutor.MakeHttpRequest(HttpRequestInfo requestInfo)
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.GetScreenshot()
at Logging.ErrorScreenshot() in C:\Users\Logging.cs:line 66
at DashboardPage.get_Verifylogin() in C:\Users\DasboardPage.cs:line 65
at Tests() in C:\Users\SmokeTests\Tests.cs:line 33
Inner Exception 1:
WebException: The operation has timed out

Using wait.until throws System.InvalidOperationException: No session ID specified

I have many test cases, where I need to wait until the page is loaded. I'm using explicit wait as the load times vary.
WebDriverWait _wait = new WebDriverWait(Drivers._driverInstance, new TimeSpan(0, 2, 0));
_wait.Until(D => D.Title);
It throws No session ID exception. I have a table that takes time to load in the page, so I tried using
_wait.Until(ExpectedConditions.ElementIsVisible(By.TagName("table")));
Even this throws the same error. The tests pass when I run each one individually and running all of them as suite raises this exception.
private static void InitialUpload(string filename)
{
SDDirectPage.filePath = filename;
SDDirectPage.filename = Path.GetFileNameWithoutExtension(SDDirectPage.filePath);
SDDirectPage.UploadButton.Click();
Drivers._driverInstance.SwitchTo();
SDDirectPage.FileReference = SDDirectPage.filename;
SDDirectPage.UploadTheFile();
//Check whether 404 occurred or the uploading file is smooth
if (Drivers._driverInstance.Title == "404 - File or directory not found.") //A bug at the moment, it uploads corrupted files most of the times.
{
Assert.Fail("404 error occurred. File might be corrupted or file mightnot be in the specified location..!");
return;
}
else
{
Drivers._driverInstance.SwitchTo().ParentFrame();
// SDDirectPage._wait.Until(D => D.Title);
SDDirectPage._wait.Until(ExpectedConditions.ElementIsVisible(By.TagName("table")));
Assert.AreEqual(SDDirectPage.filename + " - SmartDebit Front End Portal", Drivers._driverInstance.Title);
}
}
This is the function where I'm getting the exception. In some test cases, I have Assert.AreEqual, where I compare the titles. In those test cases, driver.Title raises the same error.
Here is the exception:
Test FullName: SDTestAutomation.SDDirectPage_Tests.FixInvalidRows_Search
Test Source: c:\Git\AutomationTest\automationtest\AutomationTest\SDTestAutomation\SDDirectPage_Tests.cs : line 249
Test Outcome: Failed
Test Duration: 0:02:19.2199494
Result Message:
Test method SDTestAutomation.SDDirectPage_Tests.FixInvalidRows_Search threw exception:
System.InvalidOperationException: No session ID specified
Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByTagName(String tagName)
at OpenQA.Selenium.By.<>c__DisplayClass1a.<TagName>b__18(ISearchContext context)
at OpenQA.Selenium.By.FindElement(ISearchContext context)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
at OpenQA.Selenium.Support.UI.ExpectedConditions.<>c__DisplayClass13.<ElementIsVisible>b__12(IWebDriver driver)
at OpenQA.Selenium.Support.UI.DefaultWait`1.Until[TResult](Func`2 condition)
at SDTestAutomation.SDDirectPage_Tests.InitialUpload(String filename) in c:\Git\AutomationTest\automationtest\AutomationTest\SDTestAutomation\SDDirectPage_Tests.cs:line 483
at SDTestAutomation.SDDirectPage_Tests.FixInvalidRows_Search() in c:\Git\AutomationTest\automationtest\AutomationTest\SDTestAutomation\SDDirectPage_Tests.cs:line 250
Here is the drivers class:
public class Drivers
{
static string path = #"C:\SmartDebit\SmartDebitTestAutomation\SmartDebitFramework\DriverResources\";
public static IWebDriver _driverInstance { get; set; }
public static void Initialize(string browser)
{
if (browser == "FF")
{
_driverInstance = new FirefoxDriver();
_driverInstance.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5000));
}
if (browser == "IE")
{
_driverInstance = new InternetExplorerDriver(path);
_driverInstance.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5000));
}
if (browser == "Chrome")
{
_driverInstance = new ChromeDriver(path);
_driverInstance.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5000));
}
}
}
Code for initialising the browser instance:
[ClassInitialize]
public static void BrowserInstance(TestContext t)
{
loginPage = new LoginPage();
loginPage.Init("FF");
loginPage.Goto("url of the application");
Assert.AreEqual("Login Page", Drivers._driverInstance.Title, "Login page titles doesn't match");
}
[TestInitialize]
public void Init()
{
try
{
Login();
}
catch (Exception ex)
{
Console.WriteLine("Exception:" + ex);
Assert.Fail("ValidLogin() test failed in HomePage_Tests.cs");
loginPage.QuitBrowser();
}
}
private static void Login()
{
loginPage.LoginName = "username";
loginPage.Password = "password";
loginPage.LoginButton();
SDDirectPage._wait.Until(d=>Drivers._driverInstance.Title);
Assert.AreEqual("Home Page - Front End Portal", Drivers._driverInstance.Title, "Home page title doesn't match");
Assert.IsTrue(HomePage.loggedInUserText.Contains("username"));
}
I'm using Firefox 43.0.2
Could someone help be to overcome this situation.
Thanks.
System.InvalidOperationException: No session ID specified occurs when you don't have valid driver instance in the method.
Please check Drivers._driverInstance is properly instantiated in your code. If possible post the Drivers class' relevant portions in the question.
Refer another SO question where the same problem is discussed: Disabling browser javascript with Selenium webdriver + specflow + c# + Pageobject + pagefactory
I am basically from Java, but observing the code and exception, i am excepting WebDriverWait is defined in SDDirectPage and calling here.right?
SDDirectPage._wait.Until(ExpectedConditions.ElementIsVisible(By.TagName("table")));
When you are calling defined wait method, you are not passing webdriver instance here. So i am expecting on switching to this method driver loosing the session. For sake of confirm, can you try executing the same by commenting this wait line (and my use something equivalent to Thread.sleep(5000) in Java for once to check this issue)
Thanks

Issue is when run the test, driver running first test method and next test method is failing, also new browser is opening. any idea?

written scripts using C# in Visual Studio 2013, Issue is when run the test, driver running first test method and next test method is failing, also new browser is opening. So when reaching next method driver connection is closed and starting new browser for each test method. any help pls? Below is the sample code i created :-
namespace AutomationProject
{
[TestClass]
public class ClassName
{
public IWebDriver driver;
String baseUrl = "....";
//System.Environment.SetEnvironmentVariable("restart.browser.each.scenario", "false",);
[TestInitialize]
public void BeforeTest()
{
/
driver = new FirefoxDriver();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(20));
driver.Manage().Window.Maximize();
}
[TestMethod]
public void TestMethoed1()
{
driver.Navigate().GoToUrl(baseUrl);
.............
.............
}
[TestMethod]
public void TestMethoed2()
{
driver.FindElement(By.XPath("//input[#id='submitInput']")).Click();
.........................
..........................
}
[TearDown]
public void CloseDriver()
{
Thread.Sleep(2000);
driver.Close();
}
}
}
Your problem is, when second method is being run on new browser window, which is empty is empty, so your call to find input field fails. Use drover.Navigate().GoToUrl() to get to a page you have the submit element
I got the solution after spending longtime,
issue is
first method is executed successfully. While reaching next test method current web driver is closing and new driver is opening so am getting new browser.
Solution is :
I used Nuint frame work and used [TestfixtureSetup] -> driver will start before stating test mathods , [TestFixtureTearDown] -> this will close the driver once all test method executed.

Categories

Resources