7 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[...
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:...
5 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 ...
  • 106
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 ...
  • 10.2k
3 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 ...
  • 587
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 ...
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 ...
  • 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....
  • 10.9k
2 votes

Automation Testing approach for Web Based Application

Isolate test data creation/setup from test verification. In this scenario, I would use the following strategy: 1) Have baseline test data, which is restored (through SQL scripts) before the suite ...
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 ...
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 ...
  • 11.5k
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 ...
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, ...
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;
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 ...
  • 11.5k
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 ...
  • 4,070
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']
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 ...
  • 10.2k
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.
  • 10.2k
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> ...
2 votes

Using Python Selenium Not able to perform click operation

Reason: This is a known issue for some time now. https://github.com/SeleniumHQ/selenium/search?q=ElementClickInterceptedException&type=Issues This exception suggests that there is another element (...
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 ...
1 vote

Unable to find Dynamic Xpath

I am not sure this contains(@class="login_button") is a proper xpath syntax (however since you're not mentioning parse errors looks like it is) at least for your task. Try: //*[contains(@tabindex,"3"...
  • 11.5k
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\"); ...
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 ...
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 ...
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());
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 ...
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(...
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 = ...
  • 10.2k

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