6 votes
Accepted

How to select the second tr of my HTML?

To add explanation to what you have already figured out. The problem was that with this line you correctly acquired the second row: IWebElement secondRow = driver.FindElement(By.CssSelector("table tr:...
user avatar
6 votes

Using Python Selenium Not able to perform click operation

Try using JavaScriptExecutor C# IWebElement element = driver.FindElement(By.XPath("//button[@role='button']")); IJavaScriptExecutor jse2 = (IJavaScriptExecutor)driver; jse2.ExecuteScript("arguments[...
user avatar
4 votes

How many tests to include when using Page object model

I cannot go directly to the last step The whole situation is caused by the fact you can't manipulate your application state. It may be an indication that the tools you choose do not match the ...
user avatar
  • 9,929
3 votes
Accepted

How to Incorporate the Defunct PageFactory in Selenium with C#?

From the link you provided, library is still there and you are free to use it. With disclaimer that it is no longer maintained, and possible there could be other such libraries with more community ...
user avatar
3 votes
Accepted

Automation Testing approach for Web Based Application

I do not have a separate TestBase/Service class for each test. I have just Page Object classes which contain the page factory and unit test classes which contain the test methods. Is this approach ...
user avatar
  • 86
3 votes

Strange exception when executing tests

This is one of my Page Objects. It works perfectly fine. public class MyHomePage { IWebDriver driver = null; [FindsBy(How = How.LinkText, Using = "Home"), CacheLookup] public IWebElement ...
user avatar
  • 584
3 votes

How many tests to include when using Page object model

Are you sure you are using Page Object Model? logicPage.NavigateTo(); logicPage.ClickArticles(); logicPage.SearchArticleX(); logicPage.PressArticleX(); logicPage.AddArticleXToBasket(); logicPage....
user avatar
  • 10.8k
2 votes

Automation Testing approach for Web Based Application

From the question you posed I assume that you didn't start with a testing framework and are trying to build your own, you have the built in Unit Test Framework but not the all the classes for Clicking ...
user avatar
  • 567
2 votes

How to Incorporate the Defunct PageFactory in Selenium with C#?

Additionally, is there a better/different way to incorporate Page Objects without using Page Factory? PageFactory initializes the elements and isn't altogether necessary if you change your defined ...
user avatar
  • 4,030
2 votes

How to Take full document screenshot including non visible parts

You cannot take full page screenshots with Selenium/WebDriver. The WebDriver W3C requirement specify taking screenshots as: The Take Screenshot command takes a screenshot of the top-level ...
user avatar
2 votes
Accepted

Unable to click button with selenium webdriver using C#

Well, actually I strongly not recommend to use the solution posted below unless you have clear understanding of what you're doing and why you do really need this since injecting changes into the ...
user avatar
  • 11.4k
2 votes

C# Selenium - How to write a conditional statement with multiple elements/xpaths

I am not a C# guy, I can help you with a basic idea how you can achieve this with pseudo-code, then you can translate the same in C#. Add all the check boxes to list. Loop thru the list to check ...
user avatar
2 votes

Unable to select element when element is in span than select Selenium c#

The problem is the element you are working on is NOT embedded in a select tag, so you can't use Select class on that element. When you use a Select class, a check is made that the given element is, ...
user avatar
2 votes

How to select the second tr of my HTML?

I made the following change and it worked: portalweb = secondRow.FindElement(By.CssSelector("td:nth-of-type(4)")).Text;
user avatar
2 votes
Accepted

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

There is syntax error in your xPath expression, an opening [ is missing and after the @ the attribute name is also missing. All in all it should be: //select[@name='opcao_pesquisa']
user avatar
2 votes
Accepted

How to find IWebElement in other IWebElement with Selenium Web?

Change var tmpName = webBlock.FindElement(By.XPath("//h2[contains(@id, 'attr-name')]")).Text; to var tmpName = webBlock.FindElement(By.XPath(".//h2[contains(@id, 'attr-name')]")).Text;. This should ...
user avatar
  • 11.4k
2 votes

C# - Element Not Interactable error

Element Not Interactable may be cause by two reasons: 1 - The element is hidden from the view, although exist in the DOM: Dropdown's option are hidden when the dropdown is closed. A usual pattern ...
user avatar
  • 9,929
2 votes

Selenium with C#

The standard package manager for C# / .Net is NuGet More details on the setup and management process for Visual Studio here.
user avatar
  • 9,929
2 votes
Accepted

Teardown of Multiple Threaded Tests with Selenium

You can try using the ThreadLocal Class, so each running thread would be assigned it's own webdriver instance. See pseudocode to get the idea: private static readonly ThreadLocal<IWebDriver> ...
user avatar
2 votes
Accepted

How to get Visual Studio to break on Selenium Exceptions?

VS lists the exceptions from the CLR or the languages that are supported by IDE. Selenium is a 3rd party library and therefore is not present there. In short - you can't manually add it to the IDE ...
user avatar
1 vote

Selenium c# how to handle multiple "Save As" dialog?

I would try to disable the save as functionality: ChromeOptions options = new ChromeOptions(); options.AddUserProfilePreference("download.default_directory", @"C:\Users\Usernname\Downloads\"); ...
user avatar
1 vote
Accepted

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

As you have a lot of inputs I suggest filtering for the type of the input, in this case for button. Then you can narrow down the buttons based on their value attribute. In your case the xpath ...
user avatar
1 vote

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

I think you are more aiming towards finding a correct locator for the desired button. You might consider using the below xpath: //form//input[contains(text(), 'Pesquisar')] in findElement by xpath ...
user avatar
1 vote

Selenium Web Driver, ExpectedConditions [deprecated] alternative

I recently replaced all our Wait.Until(ExpectedConditions.ElementToBeVisible(By.IDK(element)) to Wait.Until(driver => driver.FindElement(By.IDK(element)).IsVisible());
user avatar
1 vote

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

It looks like you've got the elements OK, but you can't convert elements to strings. You need to use the .Text property to get the text from the element, and then use C#'s string functions to get ...
user avatar
1 vote

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

You can write a generic xPath expression to get the value of the marked columns in an array even for multiple rows like: //tr[boolean(position() != 1)]/td[position() = 3 or position() = 4 or position(...
user avatar
1 vote
Accepted

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

First of all, we need to find the second row: IWebElement secondRow = driver.FindElement(By.CssSelector("tr:nth-of-type(2)")); Then, you can find each element by position: IWebElement client = ...
user avatar
  • 9,929
1 vote
Accepted

Compare a screenshot with saved image on Devops build server

I have used https://www.imagemagick.org for image compare. They have a Nuget package which you can add to your project and you can write code similar to below in C# or F# let img1 = new MagickImage(...
user avatar
1 vote
Accepted

Selenium Webdrive object retains page source from previous page (of CRM). But page url is current

Before accessing the page source, I refreshed the driver. driver.Navigate().Refresh(); This refreshes the DOM element too, (I guess).
user avatar
1 vote

How to check a checkbox which is not visible?

First verify the checkbox is already selected or not by using the if condition. Use this below code boolean iconEnabled = driver.findElement(By.id("1")).isEnabled(); if(iconEnabled == true) { ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible