7917/getting-error-element-should-select-using-selenium-webdriver
When I select the value form dropdown box it is throwing Error message "Element should have been "select" but was "input” is shown when I select the value form drop down box. I have tried with selectByValue() and selectByIndex().
Below is my HTML:
<div class="rcbScroll rcbWidth" style="width: 100%; overflow: auto; height: 40px;"> <ul class="rcbList" style="list-style:none;margin:0;padding:0;zoom:1;"> <li class="rcbItem">TIN</li> <li class="rcbHovered">SSN</li> </ul> </div> And the java code: Select select=new Select(driver.findElement(By.xpath(OR.getProperty("SSN")))); select.selectByValue("SSN");
how to solve the same in python .i tried
driver.find_element_by_xpath("//*[text()='Full SCan']/li").click()
and
driver.find_element_by_xpath("//*li[text()='Full Scan']").click()
both aren't working
Hi Riya, instead of using xpath, use className to identify the dropdown item. Following command would help you:
driver.find_element_by_class_name("rcbItem").click();
Hi @riya, try this:
driver.find_element_by_xpath("//li[@name='element_name']/option[text()='Full Scan']").click()
Either use element name or use option with text. Don't use both at once as shown in the above code.
You can Select element by the following method:
driver.findElement(By.xpath(OR.getProperty("SSN")).click();
and next select the desired drop down in following way :
driver.findElement(By.xpath("//li[text() = 'SSN']")).click();
Hey @Dhivya, StaleElementReferenceException is thrown when an ...READ MORE
Hi there, you are facing this error ...READ MORE
For a headless browser, you have to set ...READ MORE
For a software testing services company while ...READ MORE
The better way to handle this element ...READ MORE
enable trusted connection in internet explorer by ...READ MORE
To Allow or Block the notification, access using Selenium and you have to ...READ MORE
xpath are two types. 1) Absolute XPath: /html/b ...READ MORE
Download the latest selenium jar and replace ...READ MORE
Below code will help you: Try following-sibling axis : WebElement ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.