Issue
I'm trying to do some UI testing with Selenium and NUnit in C# but need to login through Microsoft first. After entering my information with selenium, when I try to click Sign-In I get a popup saying:
"Your browser is a bit unusual... Try disabling ad blockers and other extensions, enabling javascript or using a different web browser."
My best guess is that it is detecting that I'm using selenium, but I'm not sure as I can't find anyone else with a similar message. Is this what is happening? If so, is the solution described in the link my best option or is there another way to login to Microsoft?
Here is a rough example of my code:
[TestFixture]
public class FileUploadTests
{
IWebDriver webDriver;
[OneTimeSetUp]
public void StartChrome()
{
var options = new ChromeOptions();
options.AddArgument("--enable-javascript");
options.AddArguments("--incognito");
options.AddArgument("--profile-directory=Default");
options.AddArgument("--disable-plugins-discovery");
options.AddArgument("--profile-directory=Default");
options.AddArgument(".");
webDriver = new ChromeDriver(options);
webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
}
[Test]
public void Login()
{
webDriver.Navigate().GoToUrl("https://localhost:xxxxx/");
webDriver.FindElement(By.Id("LoginButton")).Click();
webDriver.FindElement(By.Id("i0116")).Clear();
webDriver.FindElement(By.Id("i0116")).SendKeys("username");
webDriver.FindElement(By.Id("i0116")).SendKeys(Keys.Enter);
webDriver.FindElement(By.Id("password")).Clear();
webDriver.FindElement(By.Id("password")).SendKeys("password");
System.Threading.Thread.Sleep(500);
webDriver.FindElement(By.Id("password")).SendKeys(Keys.Enter);
webDriver.FindElement(By.Id("submitBtn")).Click();
}
[OneTimeTearDown]
public void CloseTest()
{
webDriver.Close();
webDriver.Dispose();
webDriver.Quit();
}
}
Solution
I was able to bypass logging in by using an opened browser where I logged in manually. Still not sure what was causing the original problem though.
Answered By - Dallas Armieri
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.