On my website, I have a specific structure in place:
https://i.sstatic.net/bZhHvNlU.png
Whenever the button with the ID addProfButton
is clicked in the following manner:
- Using JavaScript:
document.getElementById("addProfButton").click();
- Using C# with Selenium WebDriver:
Driver.FindElement(By.Id("addProfButton")).Click();
a popup window with the ID AddProfileDialog
pops up. This particular div
element (highlighted by a brown rectangle) is not present before the button is pressed.
Within this element, there is an input field with the ID ItbInputName
that needs to be selected in order to input text. Subsequently, the button with the ID btnAddConfirmOk
needs to be clicked, which is part of the popup window as well.
But, before anything else, I have to click inside the input field:
- Using JavaScript:
document.getElementById("ItbInputName").click();
- Using C# with Selenium WebDriver:
Driver.FindElement(By.Id("ItbInputName")).Click();
However, to my surprise, this approach does not seem to work... Why is that? How can I get it to work as intended?