Can anyone help me asap
Iam a beginer in selenium iam getting the below error with the below code.
Exception in thread "main" org.openqa.selenium.support.ui.UnexpectedTagNameException: Element should have been "select" but was "span.
Below not selecting drop down code:-
//1st action on drop down
{
WebElement dd1=driver.findElement(By.xpath(".//*[@id='dcf-fieldset-row-6']/td[2]/span[1]/span[2]/span/span/span[2]/span"));
dd1.click();
//clicks drop down
Thread.sleep(3000);
2nd action on same 1st drop down(Here we need to select the option)
WebElement dd2=driver.findElement(By.xpath(".//*[@id='dcf-fieldset-row-6']/td[2]/span[1]/span[2]/span/span/span[1]"));
Select s=new Select(dd2);(In this step iam getting stopped(error))
Thread.sleep(3000);
s.selectByValue("4");
}
Even iam pasting HTML code for the below .
1st xpath below:- .//*[@id='dcf-fieldset-row-6']/td[2]/span[1]/span[2]/span/span/span[2]/span
<tr id="dcf-fieldset-row-6" class="dcf-datafieldrow-label-id-37">
![]()
<td id="label-Calls" class="dcf-fieldset-label dcf-dynamic-datafield-label dcf-datafield-label-id-37" style="height: 35px;">
![]()
<td class="dcf-fieldset-editable-value" colspan="1">
![]()
<span>
![]()
<span data-bind="visible:isItemNotEditable(), html:formattedValue('Calls')" style="display: none;">
![]()
<span data-bind="visible:isItemEditable()">
![]()
<span class="k-widget k-dropdown k-header" style="width: 60px;" title="" unselectable="on" role="listbox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-owns="Calls_listbox" aria-disabled="false" aria-readonly="false" aria-busy="false" aria-activedescendant="ba578ed5-77a1-4d1f-be72-45e73a3bd234">
![]()
<span class="k-dropdown-wrap k-state-default k-state-focused" unselectable="on">
<span class="k-input" unselectable="on">0</span>
2nd xpath below:- .//*[@id='dcf-fieldset-row-6']/td[2]/span[1]/span[2]/span/span/span[1]
<td class="dcf-fieldset-editable-value" colspan="1">
<span>
<span data-bind="visible:isItemNotEditable(), html:formattedValue('Calls')" style="display: none;"><span class="CellHighlight">0</span>
</span>
<span data-bind="visible:isItemEditable()">
<span class="k-widget k-dropdown k-header" style="width: 60px;" title="" unselectable="on" role="listbox" aria-haspopup="true" aria-expanded="false" tabindex="0" aria-owns="Calls_listbox" aria-disabled="false" aria-readonly="false" aria-busy="false" aria-activedescendant="ba578ed5-77a1-4d1f-be72-45e73a3bd234">
<span class="k-dropdown-wrap k-state-default" unselectable="on"><span class="k-input" unselectable="on">0</span>
<span class="k-select" unselectable="on"><span class="k-icon k-i-arrow-s firefinder-match" unselectable="on">select</span>
</span>
</span>
I need help on the above ASAP.
Also i want to learn xpath online can anyone refer me.
Thanks,
Sandeep Polepalli