New answers tagged

2

In general, what you are looking for is called Dependency Injection: You want to decouple your code from the data it uses, moving the responsibility of sending this data to the callers of your code. There are innumerable ways of applying it. Below is an example of setting a variable to a prod or dev environments: If you setup a configuration XML file like ...


0

Incase you are using NUnit, you can specify the details directly in the NUnit App.config file. You can view the details in the link: https://github.com/browserstack/nunit-browserstack/blob/master/NUnit-BrowserStack/App.config


0

How to do it 1)Create your Script to test a LogIn application using the TestNG class. 2) Pass ‘Browser Type’ as parameters using TestNG annotations to the before method of the TestNG class. This method will launch only the browser, which will be provided as a parameter. package automationFramework; import org.openqa.selenium.By; import org.openqa....


1

Rather than AreEqual(), I'd probably see if you can use .IsTrue() after you've selected the option. Assert.IsTrue(Driver.FindElement(By.Id("FtpTransmittalMethods")).FindElement(By.CssSelector("option[selected='selected']")).Selected); or Assert.IsTrue(ftpTransDropdown.FindElement(By.CssSelector("option[selected='selected']")).Selected); Doing it this ...


0

Please go through a Select class may its should be works // Select By Class Select Radiobutton = new Select(driver.findElement(By.id("q1_1"))); Radiobutton.selectByValue("1"); Radiobutton.selectByIndex(1); Thread.sleep(3000); please go through type attribute also its also works `(By.cssSelector("input[type='radio']")).click();


0

The xpath that you currently have will look for element with tag input and id q1_1 from the current node. driver.FindElement(By.XPath(".//input[@id='q1_1']")).Click() So , if you have executed some scripts and the current focus is on any tag after the input tag , then ".//input[@id='q1_1']" will not return any element . So instead of ".//input[@id='...


0

If the browser is not installed in the default location maybe it is good to specify the BrowserExecutableLocation. FirefoxOptions firefoxOptions = new FirefoxOptions(); firefoxOptions.AcceptInsecureCertificates = true; firefoxOptions.BrowserExecutableLocation = @"C:\your\location\Mozilla Firefox\Firefox.exe"; driver = new FirefoxDriver(firefoxOptions);


3

The choice of such design lies mainly on the product under test, tool, and the language you use. My personal preference is to: Add it in Page objects if it's being reused many times If it's just for 1 test case then, have it in the test suite itself. The reason for following the practice of not having assertions in page objects was to promote easy ...


2

In my experience, it is best to put the waits in the Page Objects. The purpose of the waits are to wait for an element to be displayed or to have the page finished loading, etc (depending on the wait you are using). Using POM, all your elements are in the page object and you write methods that utilize those elements also in the page object. Given this, you ...


1

Recently I have automated 2-factor authorization for our organization. Although it is not simple. Once you will do login on the second layer you have to get OTP from google auth service or other similar services OR through Mobile SMS. OTP we received on the second layer is, TOTP stands for Time-based One-time Passwords and is a common form of Two-factor ...


Top 50 recent answers are included