Skip to content
Advertisement

Tag: webdriver

How to solve “org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been “select” but was “input”” selenium error

I’m going to get the default selected value of the below dropdown I wrote below code to do it. But this throws the following error org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been “select” but was “input” How can I fix this? same code is working perfectly for dropdowns that don’t have “value” attribute. Answer The only explanation is there is another element

How can we pass in an ExpectedConditions as a parameter to wait.until in Selenium Java?

I’m finding trouble passing in an ExpectedConditions as a parameter in a method to wait.until(). The wait.until() expects a function to be passed in. I am relatively new to Java, and would appreciate the assistance. Offending code: wait.until() expects a function to be passed into it, which looks like ExpectedConditions.urlToBe(“http://www.test.com”). I am trying to make a method that could be

why nothing is returned when reading distance displayed on the site mentioned in the body using selenium webdriver

I am trying to read distance value from ‘Distance by Land Transport’ field from the site ( https://www.freemaptools.com/distance-between-canada-postcodes.htm) but I am getting nothing though the calculated distance value is displaying in the field. Below is my code and the site used. Questions: why I am getting nothing? ( please see below code String variable: strDist shows nothing) Interestingly, when I

Reach for the deep nested element using Selenium WebDriver (Java)

I looked through a lot of topics on Stackoverflow and tried several recommendations but could hardly succeed in resolving my particular case. I’m trying to automate Google Cloud Pricing Calculator using Selenium WebDriver + Java. I need insert the Number of instances (the first input area on the page) using Java code. My Java code is following: But NoSuchElementException is

I am getting Null pointer Exception while fetching data from the excel sheet [duplicate]

This question already has answers here: What is a NullPointerException, and how do I fix it? (12 answers) Closed 2 years ago. Code: } I am fetching the data from the excel sheet while performing test I am getting below error. Error: [Utils] [ERROR] [Error] java.lang.NullPointerException at dataDrivenFramework.dataDrivenFramework.ExcelDataConfig.getData(ExcelDataConfig.java:31) at dataDrivenFramework.dataDrivenFramework.ContactUsFormTest.formData(ContactUsFormTest.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) Here

Handle/Accept cookie pop-up in Selenium

I am trying to ‘accept the cookies’ on the homepage, but my code doesn’t work. I tried to get the new window handles and then identify the subsequent Xpath for the frame and Accept button but it never work. Answer You no need to switch frame in your case, because there is no frame present in your page. Just inspect

Advertisement