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
0
votes
1answer
35 views

Teardown of Multiple Threaded Tests with Selenium

I'm trying to run multiple test cases with Nunit in C# in which every test needs its own Selenium Chrome Driver. Before it was threaded, I handled the chrome driver with [Setup] and [Teardown] like ...
3
votes
1answer
78 views

Launch web driver without instaling it?

I was trying to launch a PhantomJS browser and it works on Azure VM. (I just point the PhantomJS.exe and it works) Then I try to launch a google web-driver and its asking me to locate the google ...
0
votes
0answers
25 views

Injecting test data into testcases from async functions through NUnit TestCaseSource attribute

I am creating a test automation framework in C# with NUnit, and I want all my testcases to run with a clean user. Fortunately, developers have already implemented a REST API which accepts POST ...
0
votes
1answer
14 views

How to identify java script variable change in selenium C#

As on the below I’m having a HTML page where it change the variable value at the run time. So the java script is to change the isrendered variable to true after 10 seconds. Even after I inspect the ...
0
votes
0answers
19 views

Getting Appium integrated with BrowserStack behind a proxy

I'm trying to get Appium WebDriver integrated with BrowserStack, using C# behind a corporate proxy server and am having trouble. I'm using CNTLM due to the proxy server, so am trying to point Appium ...
1
vote
3answers
49 views

How to find the Xpath of <Td> tag from text which lie under <a> tag of that <td> in selenium c#

I have to find text on a page, which I did. Now I need to find the xpath of the <td> element containing that text so that I can use the <td> xpath to find other elements like the image ...
0
votes
2answers
57 views

Unable to select <li> element from a <ul> list

How do I select a "li" element from a "ul" tag list? This is my current code vtenants.VT_USDelselectfld.Click(); //Clicks field to display the dropdown Thread.Sleep(500); IList<IWebElement> ...
1
vote
1answer
35 views

Specflow plus evaluation version attaching a screenshot

Is it possible to attach the screenshot in the report with an c#, specflow auto framework. I have included report template in .srprofile As mentioned in https://specflow.org/plus/documentation/...
0
votes
2answers
83 views

Element is not clickable at point (x, y) because another element obscures it - BLOCK UI class

When I run my test, I receive an error because an element obscures the element I want to click. How do I create a wait that will be executed only IF this class is detected, wait it to disappear and ...
0
votes
3answers
111 views

C# element not interactable

I am unable to click login form element below site: http://www.w-trading.co.kr/member/login.php? I try: driver.FindElement(By.XPath("//*[@id='memberId']")).SendKeys("my_id"); and driver....
0
votes
2answers
42 views

Output Contents of an Element?

I am currently creating a tool. That will login into my Krispy Kreme account and then output my saved address. I am currently at the stage where I have managed to use the tool and : log into the ...
0
votes
4answers
108 views

How to find broken links using Selenium C#? [closed]

Script for testing broken links using Selenium C#.
0
votes
1answer
24 views

How to insert data into the excel using LINQ in Selenium C#?

For a login check case-> how to insert data into the Excel sheet after each login is checked whether the login credentials are valid or not using LINQ in Selenium C#.
0
votes
2answers
40 views

Convert Selenium Web Element to String C#

Basically, I'm making a programme that logs into the krispy kreme site and to test if login was successful, I am searching for a certain web element. I'm using selenium. For debugging purposes, and ...
1
vote
1answer
64 views

Closing Driver after all test are runned

I'm using Nunit + .NetCore 2.2 in my project and I need to close the browser only after running all the tests and not after each test class. Currently the tests are closing the browser after each test ...
0
votes
1answer
70 views

Why doesn't my XPath find my element on the page?

I am trying to retrieve the content of the header and each chapter which is a repetitive structure as you can see below. For this am using Selenium and C#. My attempt, using xpath, is this: string ...
0
votes
0answers
24 views

Firefox opening wrong profile with selenium c#

I'm using selenium 3.14 with geckodriver 0.24, I'm using following code to run the existing profiles I have already created for my different accounts. FirefoxOptions firefoxOptions = new ...
-2
votes
2answers
72 views

Website login Issue in Selenium ChromeDriver

I am login to a website using Selenium and ChromeDriver. But website login details are shown as incorrect every time. But I have manually logged into the site using Chrome browser easily. How do I ...
0
votes
1answer
100 views

How to select a TreeView node in WinAppDriver

So I am trying to select a node on a TreeView using WinAppDriver, any thoughts on how to find a element that will have a value I can access the element with?
0
votes
3answers
49 views

Trouble deleting NaN in input field

I'm using Selenium to fill in a web form. The fields there have their default values, usually it's 0. If I issue the command Driver.chrome.FindElement(By.Id("ID_of_my_element")).Clear(); the value ...
0
votes
1answer
50 views

How to click a expand button if ID is randomly generated

I have a problem how to click a desired expand button if ID is randomly generated. This means that the ID has another value after refresh page. Of course, the ID has another value for each row. I don'...
1
vote
3answers
488 views

Unit Test - Testing API Methods

I was reading the following article Unit testing an API This article is about unit testing an API and the methods on a class through the interface. What I do not seem to grasp is the fact that in my ...
0
votes
0answers
409 views

Selenium Error - The HTTP request to the remote WebDriver timed out after 60 seconds after clicking install button

while creating my test using c# and selenium i ran into a issue i haven't had before. the test basically opens the web site, logs in as admin, and within the admin page i than have to install a plugin ...
2
votes
1answer
39 views

Strange exception when executing tests

I write test automation using Selenium and C#. I use the Page Object Model consistently. And have had a random bug crop up in my code: Type of member 'IWebDriver' is not IWebElement or IList
1
vote
2answers
65 views

In a Webdriver UI test, do you have to check for the existence of every element you use?

I'm working on my first Selenium/Webdriver tests, and I have a rather basic question. I was thinking of adding a login helper method, since it's going to be a rather basic feature of every test. I ...
0
votes
2answers
62 views

How can I turn a list of assertions into a table? C#/Specflow Selenium

I am very new to using C#/Specflow to write tests so thank you for the patience. I have a test that ends like this: Then the Details page should display the rating zip code And the Details page ...
0
votes
1answer
33 views

Locating a web element

I am having a bit of trouble locating a particular button in one of the ecommerce applications I am writing automation for. Here is a snippet of the mark-up: <button class="btn btn-primary btn-sm"...
0
votes
1answer
144 views

How can I use Sequential attribute with TestCaseSource in nUnit?

I'm new to unit testing and nUnit in general and I'm not sure what I'm trying to do is possible or if I'm using the right syntax (in C#). I want to pass for a test a collection of IEnumerable using ...
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 ...
0
votes
0answers
61 views

Integrating VS 2017 C# Selenium Test Cases into TFS

Ok I am new to TFS only just got access to it in my company. I have been writing UI functional website test cases in VS 2017 using selenium and c#. I now wish to integrate these into TFS. From a ...
0
votes
3answers
83 views

How to click a checkbox if only value is different for each row

I have a problem how to click a desired checkbox if only value is different for each row. Here is a code for a first row with 'Access all mailbox': Thanks in advance for your help.
1
vote
1answer
155 views

TFS Selenium C# Visual Studio 2017

I have recently joined a company and they use TFS. I am an automated tester so I have setup MS Unit framework, selenium and c# within VS2017. I am comfortable in doing this standalone because its ...
2
votes
1answer
164 views

Retry in nunit not working when test times out

I am using Timeout attribute for nunit test case as below: [Test, TestCaseSource("TestCases"), Retry(2), Timeout(10000) public void test(){ // Some code that runs for more than 10 seconds } I ...
0
votes
1answer
42 views

How to print out a list of students (from this dictionary) with a score above 40? [closed]

How can I print out a list of students (from this dictionary) with a score above 40, please: I would like to use an "If", else statement. But, I need help with how to get the computer to pick the 2nd ...
0
votes
1answer
440 views

The name PageFactory does not exist in current context

I am using a POM in C# with Xunit as a framework, and am getting error in pagefactory for the following code: PageFactory.InitElements(driver, login); Error: "The name PageFactory does not exist ...
0
votes
0answers
140 views

Selenium C# Tests on Various Browsers

I would like to run my tests on multiple browsers but NOT in parallel. I want to provide a pop up to the user to choose which browser (IE, Chrome, Firefox) to execute all tests on when first started. ...
0
votes
0answers
123 views

Writing selenium tests againgst bootstrap Checkboxes

I have currently a big Problem to click on a Checkbox in a bootstrap designed GUI. In Html it appres like this: Does someone know how to press the Button of this checkbox? Because the controls are ...
0
votes
0answers
42 views

Why does my appium server skip my second emulator on parallel test

I have done the following: Start Selenium Grid Started 2 emulator; Started appium servers for both using appium -p --nodeconfig /absolute/path/.json Ran my script: DesiredCapabilities cap = new ...
1
vote
1answer
2k views

PageFactory is deprecated in C# (.NET) - what to use instead of that

I was using for a long time PageFactory (in Java). Now writing tests in .NET I found out it's deprecated. Right now I just initialize all page objects when application starts using [BeforeScenario] ...
-1
votes
1answer
35 views

(C#) Selenium - How to validate if a tr exists in an HTML page

I need to check in an HTML page if the "tr" exists, if the td does not exist that it condonue to execute the code and does not present an error for not having found, as it presents in the following ...
1
vote
2answers
197 views

Can not find getPageSource method in visual studio 2017

I am using Visual Studio 2017 and found that class ChromeDriver does not contains method getPageSource(). Does anybody knows why? using System; using System.IO; using OpenQA.Selenium.Chrome; ...
1
vote
1answer
54 views

(C#) Error in Loop for with If in a string search [closed]

Even finding the desired value in the register vector displays the message "TP não encontrado". I need that when the value is found it does not display the message that was not found. for (int i = 0; ...
1
vote
1answer
397 views

How to find IWebElement in other IWebElement with Selenium Web?

I'm trying to get some IWebElement in other specific IWebElement which I find, but it doesn't work. Here I find all of the repeated HTML blocks, it works OK: List<IWebElement> ...
4
votes
2answers
2k 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">...
-1
votes
1answer
1k views

(C#) Selenium: How to convert an IWebElement to String?

Error CS0029 Can not implicitly convert type OpenQA.Selenium.IWebElement em string What I am doing is: // Declaration of the global variable portalweb public string portalweb; // function to click ...
2
votes
3answers
545 views

(C#) Selenium: How to extract information from html and write to a variable

I want to know how to get the HTML tag information and write to a C# project variable. Remember that I can not change the HTML because I do not have access. In the example below, it is necessary to ...
1
vote
1answer
80 views

(C#) Selenium: How do I choose an option within a ComboBox?

How do I select the "C" option of my ComboBox "opcao_pesquisa"? <form name="Form1" method="post"> <input type="hidden" name="operacao" value="1"> <input type="hidden" name="d" ...
2
votes
2answers
58 views

Selenium: How do I use the button of my HTML in WebElement?

How do I locate my button that has the text Pesquisar > in my Selenium WebElement? My HTML: <div style="font-size: 10pt; font-weight: bold">Portais </div> <hr> <form name="...
0
votes
2answers
430 views

Getting row count of HTML table always returns 1?

I wish to grab an HTML table and extract the number of rows it has. I stumbled upon a solution linked here link. However, the proposed solution always returns row count of 1. I've alswo tried the ...
2
votes
1answer
74 views

Select elements within <div> and <iframe>

We started test automation on our web app (ASP.NET). We should've done it ages ago and the meantime the app has become complex so our Selenium progress is very slow. I'm completely new to Selenium and ...