What is the method for inputting text into a textbox during automation testing?

I am currently testing out c# with selenium on the website . One of the first steps is to log in to the site.

To do this, I located a button named "Вход" in the top right corner using xpath and clicked on it.

After the page refreshed and changed, the link remained the same ().

Next, I need to input my login credentials on the page and submit them. However, I am encountering difficulties as the code I used did not work:

//this doesn't work
driver.FindElement(By.XPath("//*[@id='auth-container__forms']/div/div[2]/form/div[1]/div[1]/input")).SendKeys("user");
driver.FindElement(By.XPath("//*[@id='auth-container__forms']/div/div[2]/form/div[1]/div[2]/input")).SendKeys("password");
driver.FindElement(By.XPath("//*[@id='auth-container__forms']/div/div[2]/form/div[3]/div/button")).Click();

I have also attempted to use SwitchTo().Frame without success. Any guidance or assistance would be greatly appreciated.

https://i.stack.imgur.com/JQcEg.jpg

Answer №1

Make sure to patiently wait for the element to become available by utilizing this code snippet:

new WebDriverWait(driver, TimeSpan.FromSeconds(timeout)).Until(ExpectedConditions.ElementExists((locatorValue)));

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to locate an element on a website that consistently changes its label ID buried deep within nested DIVs?

I'm facing an issue with my website tracking system, where I am trying to extract shipment details using Selenium in Python and save them to an Excel file. However, I am encountering difficulties with getting Selenium to function properly. It keeps sh ...

Guide to Executing the Appium Selenium Mobile Automation Script on a Different Machine Remotely from the Primary Code Machine

Is it possible to execute the Appium Mobile automation script from one main/coding machine to another machine that has a connected device? I am interested in learning about the required software and prerequisites for running the code on a different machin ...

Is it possible to execute selenium tests without utilizing the Webdriver interface in your codebase?

Recently, I experimented with running a Selenium test without utilizing the Webdriver interface in my code. Surprisingly, the code performed as expected without encountering any issues. System.setProperty("webdriver.chrome.driver", "C://Java learning//Sel ...

Steps for setting up WCAG2AA compliance rules in axe-core for Selenium Java1. Begin by installing

Looking to incorporate WCAG 2AA rules in Axe while using Selenium. Can someone offer guidance on the correct syntax? JSONObject responseJSON = new AXE.Builder(getBrowser() .getWebDriver(), scriptUrl).options( ("{ ru ...

I am encountering difficulties with Selenium not being recognized while utilizing Python in Visual Studio for automation testing

Just getting started with Python in Visual Studio for automation testing and having trouble with the Selenium library import. Can someone provide some guidance? To replicate the issue, follow these steps: Ensure you have the latest version of Python ins ...

Accessing a document using protractor

It seems like every protractor example I come across online uses browser.get with a web URI. browser.get('http://localhost:8000'); I want to use Selenium to navigate to a local file:// path without needing a web server running. Just a simple HT ...

Looking for advice on dealing with the gmail compose button. I've been attempting to locate the element using xpath, cssSelector, and other methods but haven't had any success

After logging into my Gmail account, I am facing an issue with clicking on the compose button. I have tried locating the element using various methods like XPath (Static, dynamic, and customized), cssSelector but it fails to find the element. Can anyone pr ...

What is the best way to create a report.html file for each testsuit (.robot file) in RoboTFramework?

Currently, I am utilizing a single PyCharm project to execute various test files for a specific website. For instance, I have robot files containing test cases like: loginTest.robot, purchasetest.robot, signinwith_facebook.robot However, whenever I run t ...

Error Encountered: "Attribute Error with Selenium in Firefox 61.01 64 Bit using Python 3.6 (32-bit)"

I'm in need of assistance. My program works flawlessly until it reaches an error with the "assigned to" field. I have reviewed the code and cannot identify any issues with it. The field type is assigned group, and it is properly populated with the wri ...

Incomplete roster of kids using Selenium in Python

Does anyone have a solution for retrieving all the children of an element in HTML? Here is the structure of the html: Check out this image of the html structure I've tried the following code: time.sleep(30) stocks = browser.find_element_by_class_na ...

Attempting to scan through each Reddit headline in order to make a decision on which one to click

I have been attempting to extract the titles of each post in text format, but I've had no luck so far. Each title is enclosed within an h3 tag and my previous approach using this tag has not been successful. Below is the code snippet that I have deve ...

What could be the reason why my TestNG xml file is not directing to my Java Class?

Why isn't my TestNG XML file able to locate my Runner Class? This is how my XML File looks like: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" > <suite name="Cucumber Framework" verbo ...

Utilizing a blend of UI script and personalized server-side scripts to initiate automated testing through TestRail

Many teams opt to run their automated tests separately from TestRail, usually through a continuous integration system, while using TestRail's API to input the test results. However, I am interested in initiating automated tests directly from TestRail ...

How can I use XPATH and Python Selenium to select the text node that is outside of an <a> element?

Check out the following link: Within this section of code: //*[@id="main-contents"]/div[1]/table[1]/tbody/tr/td, there is a piece of text Mottled Boar slain (10) //*[@id="main-contents"]/div[1]/table[1]/tbody/tr/td/a This part contains only: Mo ...

Selecting an item from a drop-down menu using WebDriver in Java - the ultimate guide!

Having a dropdown button, clicking it will open a list of items to choose from. Here's the HTML: <button id="btn-append-to-body" class="btn btn-primary mobile-quick-button dropdown-toggle" type="button" uib-dropdown-toggle="" aria-haspopup="true" ...

Issues arise when attempting to switch to an iframe using Selenium 4.7.2 in Java, paired with ChromeDriver 108, due to timeouts

Prerequisites: In order to interact with input fields in an iframe on the page, I must first switch to that iframe. Versions The Selenium version is 4.7.2 (specifically artifact id = selenium-devtools-v108) Standalone-chrome: 108.0.5359.124 Chromedriver ...

Conceal Firefox Navigation Bar with Selenium in C#

Automating tasks with Selenium has been an interesting journey. Check out my code snippet: FirefoxOptions options = new FirefoxOptions(); options.AddArguments("--disable-infobars"); FirefoxDriver driver = new FirefoxDriver(firefoxDriverService, o ...

I recently began working on a script using HtmlUnitDriver but encountered an unexpected error

I have encountered an issue while working on a script using HtmlUnitDriver. The error message I am receiving is "java.lang.NoClassDefFoundError". Could someone assist me in resolving this problem? Please review the code and error details below. Below is t ...

"Encountering InvalidArgumentError when attempting to execute webdriver with proxy

Struggling to set up webdriver.Firefox() with a proxy, I've tried various solutions but my IP doesn't seem to change. The only solution that worked for me is: def install_proxy(PROXY_HOST,PROXY_PORT): fp = webdriver.FirefoxProfile() prin ...

Updating the default download folder for Chrome Webdriver

Seeking guidance on how to modify the default download location for Chrome using Selenium-Perl. Utilizing Chrome Webdriver alongside the Perl module Selenium::Remote::Driver. Found solutions in Java but struggling to locate a Perl-specific example. ...