C# Selenium: dropdown won't open

71 views
Skip to first unread message

Maciej K

unread,
Oct 14, 2023, 1:09:03 PM10/14/23
to Selenium Users
Hi guys,
I've received recruitment task from my possible next employer to create small framework using Selenium and .NET

This is the app:

And this is one of testcases that I need to automate

Scenario 1 – Create contact:
1. Login
2. Navigate to “Sales & Marketing” -> “Contacts”
3. Create new contact (Enter at least first name, last name, role and 2 categories: Customers and
Suppliers)

I'm stuck for three days already inside step 3 - that "role" dropdown is a major pain in the a$$, however I try to handle it, that dropdown won't stay open and I can't choose that damn role without having it opened.
I tried many many different approaches (explicit waits, fluent waits, wait combinations, actions with MoveToElement, doubleclicks,,using Keys.Tab etc) and still nothing. 
If I place Thread.Sleep(1000) before that click - no problem...(yep I know it's a bad practice).
I'm out of ideas : /
Anyway I added my code in the attachment, it's without Page Object Model yet, just one file with commands.
code.cs
Message has been deleted

Michael James

unread,
Nov 30, 2023, 2:15:56 AM11/30/23
to Selenium Users
I hope this message finds you well. Upon careful consideration of your stated requirements, I have identified a parallel challenge pertaining to the business role dropdown.
As you correctly highlighted, the dropdown doesn't stay open, making it challenging to acquire the XPath for its items.
 In light of this, I would like to recommend the incorporation of a Chrome extension known as Selectors hub. This extension proves to be a valuable asset in situations, where the dropdown doesn't stay open consistently, making it effective for extracting XPaths.

Screenshot (200).png
I have provided the supplied code for your review concerning this matter. I am available to assist further and ensure a seamless resolution of this issue.

C# code.txt
Reply all
Reply to author
Forward
0 new messages