Questions tagged [c#]

Use for questions about testing using C#. This can include unit tests, integration tests, UI tests. If a programmed test uses C#, and the question relates to testing rather than to code, the C# tag should be used.

Filter by
Sorted by
Tagged with
38
votes
4answers
10k views

Are Selenium functional tests reliable enough to be worthwhile?

I'm finding that regardless of how solid my tests scripts are, I still have tests that fail (falsely), even though they worked just fine before. I'm not talking about if markup changes (although that ...
18
votes
5answers
9k views

How does one get started with web test automation using Selenium?

So I've been testing web based analytical software now for the past 4 years or so with mostly manual techniques. But for 2015, I've set myself the goal of getting setup and start writing automated ...
11
votes
5answers
28k views

How to start a Selenium2 WebDriver window in background?

I have a series of Selenium2 test cases in C#/NUnit that are run sequentially. Each test case runs in a new instance of the WebDriver (and this is necessary) - which means that each time a new test ...
9
votes
3answers
755 views

Where tools for automated UI test like selenium or Coded UI fits in Dev Ops cycle

My manager asked me to look into how we can utilize automated UI testing to gain productivity and help testers automate basic functionality of the system. I developed few test suites and cases using ...
9
votes
2answers
15k views

How can I send the action “Ctrl” + “Alt” + “Double Click” to the browser

I am writing automated tests for a site at work and we have certain screens that when we send a specific set of keystrokes, a section of the page will become visible and allows us to see information ...
8
votes
1answer
15k views

Adding user-data-dir option to ChromeDriver makes it not work and timeout only

Using .NET's C#: I was thrilled to learn how to start a web driver session with your local cookie data here. The browser now starts with my bookmarks and cookies loaded (I tested accessing sites ...
7
votes
3answers
6k views

How to disable infobar from Chrome

The option to disable infobar "Chrome is being controlled by automated test software" was removed from Chrome. Chrome version: 65.0.3325.146 Chrome driver: 2.36 OS: Windows 10 I used the ...
7
votes
2answers
14k views

The HTTP request to the remote WebDriver server timed out after 60 seconds

I am running selenium tests in C# and every now and then I get this error while initiating or running my tests: The HTTP request to the remote WebDriver server for http://localhost:7055/xxxxx timed ...
6
votes
3answers
1k views

Is there any way to click on 6th item of this list

As on the image I have to click on the 6th item on the list. I can easily do this with IList<IWebElement> But is there any way to do the same thing with the help of 2005256 digit which is ...
6
votes
2answers
2k views

Why does selenium fail every so often when running more complex tests because it can't find an element on the page?

private IWebDriver driver; private ChildSearchPage currentChild; private IWebElement divMeetingsTab { get { return driver.FindElement(By.Id("Content_InfantTab1_divMeetings")); } } private IWebElement ...
6
votes
1answer
3k views

Read requests and responses made by browser on naviagating a web page in C# webdriver

I wants to read all the requests and responses made and get by the browser on navigating on a page. For example: If I navigate to http://www.yahoo.com then we observe that browser is making a lots of ...
6
votes
4answers
8k views

API Testing tools in C#

I'm looking at writing at automated tests to cover regression testing in respect of Restful API's. I have familiarity with how to do this in Java using Rest Assured, however the company I currently ...
6
votes
2answers
18k views

How to stop running selenium tests AFTER webdriver.quit()?

I have made a Windows Forms app to host my GUI for running selenium tests. When the user presses the "run test" button, it launches an instance of chromedriver and runs the selected selenium test. ...
6
votes
1answer
2k views

What's the best way to test log4net logging?

What's the best way to test log4net logging? As logging is to some degree an interface to our component, I want to make sure it keeps working as it can be configured in a few different ways. Should ...
6
votes
2answers
3k views

Writing automated tests for System.Web.HttpApplication

I am currently using Moq to write automated tests for System.Web.HttpApplication in C#: public FakeHttpApplication CreateBaseMocks() { MockContext = new Mock<HttpContextBase>(); ...
6
votes
1answer
2k views

Inconsistent results when capturing javascript errors with WebDriver

I'm using a technique I found here, to capture javascript errors for testing purposes. It's a technique that is frequently recommended on Stack Overflow for those who need to catch JavaScript errors ...
6
votes
2answers
657 views

How to make run only failed test cases in NUnit

Can anyone please tell me how to run only failed test cases using NUnit.
6
votes
1answer
536 views

How to ignore a test in C# when CurrentEnv is Prod

I have created a ProdIgnoreAttribute which extends from IgnoreAttribute. And I have assigned this attribute to certain tests which I want to run in DEV/QA but not in PROD. ApplyToTest(Test test) ...
5
votes
5answers
126 views

Useful real-world APIs to test against

In order for me to firm up my understanding of API testing I'm looking at testing against some real-world API's. For understanding, I'm going to be writing my API tests in C#, ideally utilising ...
5
votes
3answers
2k views

Can NUnit be used for Functional and Regression testing?

Now, here the confusion starts. I was creating some test cases using Selenium WebDriver with C# and thought of using a testing framework. My task is to create functional test cases which can later be ...
5
votes
5answers
32k views

How to wait for element to be clickable in WebDriver with C#

How can I wait for element to be clickable in Selenium WebDriver? When I execute my tests in Firefox or Internet Explorer I have no problems, but when I try to run it on Chrome, I get an element is ...
5
votes
3answers
8k views

Options for headless browsers for .net?

I am looking at speeding up my automation using a headless browser. I tried converting my tests to use PhantomJS but test stability took a big hit. Some pop ups don't seem to render correctly, tests ...
5
votes
2answers
16k views

Problem catching Selenium Webdriver NoSuchElementException

I have many test cases written in C# using Selenium2 Webdriver with NUnit. I have a problem that when a NoSuchElementException is thrown, it is treated as an unhandled exception despite me using a ...
5
votes
3answers
7k views

Selenium waits for Page object model

I am building a testing framework for my website I want to fully separate the framework away from test the issue is when I write a test sometimes the Assert needs time until it can be true, for ...
5
votes
3answers
2k views

How do I unit test Word AddIn written in C#

I need end-to-end guidance on this topic. Here is a scenario: I have a Word AddIn written in C#, in which I have some interop interaction with Excel. I need to unit-test that. How? There is no ...
5
votes
1answer
20k views

How to fix “Permission denied to access property 'document'”?

I posted it on stackoverflow.com. Someone suggested me to post it here... While trying to automate testing with selenium rc I ran into this problem. I was just following the steps in the tutorials. ...
5
votes
1answer
178 views

Page object Model discussion

I am building a test framework for my Website using Selenium, I actually want your ideas of good practices when using Page Object Model: let us say that I have a Welcome page that contains a header ...
5
votes
2answers
2k views

Mocking IVR system

I am new to automation testing and was looking for guidance on how I can mock or create a simulator for a IVR ( automated call system ). We have an application, which sends some user data to a third ...
4
votes
6answers
7k views

Force Selenium to wait for spinner to disappear before resuming

I'm stuck with this problem: Our test page will show a spinner while loading data. To solve this problem I added the following lines in a method to make sure the spinner was not present before ...
4
votes
2answers
1k views

How to select the second tr of my HTML?

The code below works but it only selects the first tr: My HTML: <script>if(''!='') { document.Form2.endereco_ip.value='';}</script> <div style="font-size: 10pt; font-weight: bold">...
4
votes
1answer
221 views

Unit tests: avoiding overspecification

Say I have the following method that sends emails. I know I should have tests for the different status codes returned. I am also testing if the the methods CreateMail() and Send() are being called. I ...
4
votes
1answer
6k views

Coded UI - How to launch website in IE InPrivate Browsing mode?

I am trying to launch my website by default in IE InPrivate mode so I can get rid of tons of code to handle multiple scenarios (listed below) script may counter during execution. My goal is to run ...
4
votes
1answer
1k views

Testing EJB based web service - Java vs .NET vs SoapUI

I am testing a workflow application that takes the user step by step through each task. The inputs in each task are basically just barcodes or some numerical values. Fortunately, each task has an EJB ...
4
votes
2answers
294 views

Selenium Test Design Struture - Test Granularity for a Large Project

Summary I have large Selenium Test project, and I'm struggling with how to manage my test structure in a way that I feel is easily maintainable, scalable, and that provides a good level of test ...
4
votes
2answers
4k views

Alternative for user extensions in Selenium 2 WebDriver w/ jQuery?

I've been switching over our company's automation scripts from Selenium IDE to Selenium 2.0 WebDriver. The problem is that we have a crap load of user extension custom commands because of all the ...
4
votes
1answer
185 views

Headless browser testing

I have a question around headless browser testing which I am looking to utilise in my automation framework, which is written in c#. Headless browser testing is not an area I'm familiar with but I'm ...
4
votes
2answers
4k views

Explicit wait is not reliable with Selenium C#

While creating test scripts in Selenium WebDriver using C#, I have used Explicit wait (after going through this link) and have also gone through SO and SQA links for the same. So, I implemented it ...
3
votes
2answers
22k views

Selenium Webdriver, C# and accessing rows in a table

There's been other questions like these, but I feel like I'm missing some of the basics, so I'll try asking a potential duplicate question: How do I get/list the contents of each row in a table like ...
3
votes
3answers
1k views

Do we really need testing framework when creating automation tests in C#?

I am new in automation, and my team is going to create an automation testing framework and we selected hybrid framework. We are using C# and Visual Studio. I am looking for selenium tutorials and I ...
3
votes
5answers
3k views

Selenium Webdriver: Finding elements and contents in deep structures

I've got a fair basic grasp about how Selenium works, and I'm comfortable at a beginning level using it in VS and C#. However, when it comes to finding things in pages which are not straight-forward ...
3
votes
2answers
5k views

Selenium and C#: Check if an element is present and click it, else skip and go to next step

I'm using Selenium and C# to test a widget that is implemented across multiple websites however on a few of these websites there is an additional drop down. I'd rather not just ignore this additional ...
3
votes
2answers
63 views

Need to get search suggestions from you tube selenium c#

I need to get suggestions from YouTube search text box. So far I was doing somthing like below code. But nothing works for me. I got data on the List, but the "aa" text was null ...
3
votes
2answers
11k views

Selenium C# - How to wait with WebDriverWait using the element as parameter instead of a locator?

I have a big problem, and I don't find the solution. I have 2 classes: Components_BI.cs with this component: [FindsBy(How = How.XPath, Using = "//*[@id='body-container']/div/div[1]/div/div/button[...
3
votes
2answers
3k views

StaleElementReferenceException with explicit wait

In my code I used Explicit Waits: private WebDriverWait wait; wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); I tried these methods: wait.Until(ExpectedConditions.ElementExists(By.Id("&...
3
votes
2answers
9k views

I am unable to switch to popup window in c# selenium

I have to create a new record, for that a new popup window opens. so i am unable to switch to that window. I used this code to switch the popup window foreach (string handle in driver.WindowHandles) {...
3
votes
5answers
86k views

Trying to find span element by class and text with selenium c#

I want to click on Administration panel. The <span> contains a class attribute and inner text. I get an error saying "unable to locate element". What am I doing wrong? HTML: <div class="...
3
votes
1answer
5k views

Using Selenium's PageObject pattern and an Open() method

Here is an example of some C# WebDriver code I'm using to model a registration page: public class RegistrationPage : BasePage { private IWebDriver driver; private String URL = "http://...
3
votes
1answer
6k views

Unable to launch Chrome in remote webdriver

I have tried the following three options . I am using C# DesiredCapabilities capabilities = DesiredCapabilities.Chrome(); capabilities.SetCapability("chrome.binary", "pathtogooglechrome\chromedriver....
3
votes
1answer
990 views

BDD SpecFlow w/WatiN test during/after redirect

I have begun to use SpecFlow and WatiN to automate UI tests in IE9, and am encountering a maddening problem which may have nothing do to with either, but hey. I have the following step: [Then] public ...
3
votes
1answer
1k views

Deploying Selenium RC tests with Teamcity

I'm looking at setting up my Selenium tests in a QA environment which will run with a Teamcity build each time. This seems to be the best resource I've come across so far where someone has gone ...