Exception In Thread : Unexpectedtagnameexception
I am Trying to Locate Dropdown using Select but its giving me error : Exception in thread 'main' org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have bee
Solution 1:
As exception clearly saying you are locating the input
element but trying to work as select
element.
new Select()
expect select
element as input while you are providing input
element as input.
You need to verify your provided id ctl00_MainContent_ddlLocale_Input
is the id of input
element or select
element.
If in your case the ctl00_MainContent_ddlLocale_Input
same for both input
and select
elements, then you need to try usimg cssSelector
to specify select
element as below :-
Selectdropdown=newSelect(driver.findElement(By.cssSelector("select#ctl00_MainContent_ddlLocale_Input")));
//dropdown.selectByIndex(2);
dropdown.selectByValue("Austria: Vienna");
Hope it helps..:)
Post a Comment for "Exception In Thread : Unexpectedtagnameexception"