8

The Stack Trace in the unhandled exception message should tell the developer what crashed and when. Your provided Steps to Reproduce should also help pin down the issue (a developer can't fix what they can't reproduce). In that case the exception should be fixed and/or handled better in future releases. Just report it like any other bug.


8

You can create an Even listener: EventListeners (NUnit 2.4.4) Interface The extension object passed to Install must implement the EventListener interface: public interface EventListener { void RunStarted( string name, int testCount ); void RunFinished( TestResult result ); void RunFinished( Exception exception ); void TestStarted(TestName ...


5

How Selenium determines whether an element exists and how it behaves when an element is not found seems to vary from one release to the next. With the current release, it is possible to finesse the problem by switching to the findElements method. For example, in Java I would do something like this: elements = driver.findElements(By.id(Element_ID")); if (...


4

It seems that you have mismatched your coding standards. WebElement userName= driver.findElement(By.id("txt_UserName")); userName.clear(); userName.sendKeys("karthik"); WebElement paswd= driver.findElement(By.id("txt_Password")); paswd.clear(); paswd.sendKeys("Enter your Password"); paswd.submit(); Confirm once your locators of Username & Password ...


4

1.Use following XPath Locators: //button[contains(@id,'shippingSubmit') and (@name,'shipSubmit')]; OR //button[contains(@id,'shippingSubmit') and starts-with(@class,'visible-xs-block')]; OR //button[contains(.,'Continue to Payment')]; 2. Add Explicit Wait before clicking to the particular button. contpayment = WebDriverWait(driver, 10).until( ...


3

Understand - Cause why this occur Any of your file is present at the compile time but its not reachable at the execution time You need to crosscheck both compile time and run time environment & class paths


3

You may use the Actions for this. Since the HTML code does not have Select class, you cannot use the Select statement for this dropdown list. The HTML code has Span class, so it will be easier to use Actions for this object than Select. Actions drpdwn = new Actions(driver); driver. findElement(By.xpath("XPATH OF DROPDOWN FIELD")).click(); Action ...


3

The EventListener is the way to go. However there is a knack: the UnhandledException will not be fired when an Assertion in your test fails. Rather use the TestFinished event to handle failed tests: public void TestFinished(TestResult result) { if (result.Executed && result.IsFailure) { Console.WriteLine(string.Format("Failure in ...


3

JMeter doesn't come with any JDBC driver shipped. Looking into stacktrace I can see that you're using Oracle and presumably 10g version. You need to download Oracle JDBC driver (or better fetch it from ORACLE_HOME/jdbc/lib, you'll need ojdbc6.jar as it matches Java 6 which is required for the latest JMeter) and drop it to /lib folder of your JMeter ...


3

Simply use @BeforeTest & @AfterTest instead of @BeforeMethod and @AfterMethod. Launch URL before pageLoadTimeout and implicitlyWait. Make sure you have added double '//' in your driver path. Try This: public class GoogleTestTestng { public WebDriver driver; @BeforeTest public void setup(){ System.setProperty("webdriver.chrome....


2

According to WebDriver API JavaDoc, if no matching elements are found then the NoSuchElementException is thrown by findElement() method, not NullPointerException. So the root cause of your problem is not a wrong XPath expression. Instead, your stacktrace and your source code suggests this is a problem with driver variable not initialized: you try to call ...


2

You can use simple click & enter for the first drop-down element selection. driver.findElement(By.id("DROP-DOWN FIELD XPATH")).click(); driver.findElement(By.xpath("FIRST ELEMENT XPATH")).click(); driver.findElement(By.xpath("FIRST ELEMENT XPATH")).sendKeys(Keys.ENTER);


2

There could be 2 possibilities for your NoSuchElementException That locator you are using to find the webelement is wrong. Hence it is giving you the error. You are trying to click on the webelement even before it is loaded completed on the page. To solve this. Always use the explicit wait to let the webelement get loaded before performing any execution on ...


2

"chromedriver": "^2.36.0", "selenium-webdriver": "^4.0.0-alpha.1", here example of create driver function: import webdriver from 'selenium-webdriver' import chrome from 'selenium-webdriver/chrome' import chromedriver from 'chromedriver' const TIMEOUT = 300000000 export default async () => { chrome.setDefaultService( new chrome.ServiceBuilder( ...


2

The id of the input element looks auto-generated - you probably cannot use it to locate the element directly. There are so many ways to get to the element, but I think, using the label's text and then using the following-sibling axis is one of the most explicit approaches: //label[. = 'Select Location(s)']/following-sibling::input


2

I had a same issue. It is due to a version issue. You can use: driver.manage().setTimeouts() or driver.sleep() please, check the documentation for more details.


2

You forgot to instantiate elements of your page. PageFactory.initElements(...) Refer to this question to get the details: How to Implement Page Object and Page Factory Pattern in Selenium Webdriver?. Since your fields are not instantiated, they are not deployed in memory, so when you are trying to access method of not existing object in emails.sendKeys("...


1

I was having the same problem and this fixed it: const capabilities = await driver.getCapabilities(); capabilities['map_'].set('timeouts', { implicit: TIMEOUT, pageLoad: TIMEOUT, script: TIMEOUT }); getCapabilities() retrieves the Map of the driver's capabilities which you can then interact with using the default methods outlined in the MDN Javascript ...


1

When you created the MainPageObject (mainPage = new MainPage(driver);) it was just inside the scope of the setUp method. Thus, when it ended, the object was sent to the Garbage Collector. You would need to make this object an attribute of the MainPageTest object, the access it inside the tests: this.mainPage.clickSignIn()


1

Your image element is in iFrame, So first you need to switch into related iFrame and then you can perform desired actions on that element. There are following ways provided in the Selenium to work with iframes : Switch using frame Index driver.switchTo().frame(0); // used indexes 0,1... as number of frames you have in webpage Switch using frame id (if ...


1

I was also facing the same issue. I've added guava JRE.jar in project You can refer here https://mvnrepository.com/artifact/com.google.guava/guava/23.6-jre to add maven dependency OR Download guava_jre.jar file from http://central.maven.org/maven2/com/google/guava/guava/23.6-jre/ and add it in your project


1

The problem with your If Controller's condition, most likely you have an infinite loop or something like that there. If this is not the case and you're totally sure in your condition logic try switching to __groovy() function instead of JavaScript which is the default language of the If Controller, Groovy is the most performing scripting language supported ...


1

There is one small mistake you made, You have forget to initiate the instance of webdriver. This is the reason why you found the null pointer exception. As your project is in Java Based, So require to follow java code standards and formats as well. Here is the correct code : @Test public void openBrowser() { try { System.setProperty("webdriver....


1

As it appears, though you are setting the property for the chrome driver through System.setProperty("webdriver.chrome.driver", "C:\\Selenium\\chromedriver_win32\\chromedriver.exe"); You are not initializing the driver instance before using it like : driver.manage().window().maximize(); So please add the following line as follows: System.setProperty("...


1

If you're getting the error on the assertion line, it's exactly what the message tells you - you're getting a null reference. Often this is due to the fact that your FindElement() fails, so then when you try to access one of the methods or properties (e.g. click() or Displayed), you get a null reference error since the object isn't what you think it is (it'...


1

The following should work. I've used the class name for the login button instead of using XPath (seems more appropriate here) + always use explicit waits never Thread.sleep! //Instantiate Firefox Driver //Go to CV Library Website var driver = new FirefoxDriver(); driver.Navigate().GoToUrl("https://www.cv-library.co.uk/"); WebDriverWait wait = new ...


1

I would suggest you wait for the webelement to get loaded first then perform the activity that you want to do. //Initialize a wait for 30 seconds. WebDriverWait wait = new WebDriverWait(driver,30) wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("selectURL"))); /*Waiting for the WebElement to be Visible.*/ Select URLSelect=new Select(driver....


1

When you return back to the page, page reloads and all elements become stale. For you it may look like same element (with same locator), but page is new object. So you need to fetch the elements again.


1

On the Scorex_LoginTestCases (Btw, we do not use underscore in names in Java (See conventions), the objects objLogin and objHome are not initialized. On the TestBase, you should initialize them using the PageFactory's method initElements. You can see a sample here.


1

I used a helper function to see if at least one element still exists. Because I'm finding a new element each loop, StaleElementException doesn't occur anymore. while(isElementVisible(d, (By.ClassName("search-choice-close")))) { d.FindElement(By.ClassName("search-choice-close")).Click(); TestHelper.WaitForAjaxCompletion(d); }


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