-1

I am getting the above error : Below is the xpath :

String MeetingTypedropdown = "//*[@id='meetingDatesForm:meetingDatesTable_data']/tr["+(i+1)+"]/td[3]//div[3]/span";
PageUtil.clickOnlink(driver, MeetingTypedropdown);

On clicking the dropdown getting invalid selector Exception.... Below is html:

<div class="ui-cell-editor-input">
<div id="meetingDatesForm:meetingDatesTable:6:j_idt310" class="ui-selectonemenu ui-widget ui-state-default ui-corner-all widthLarge" role="combobox" aria-haspopup="true" aria-expanded="true" aria-owns="meetingDatesForm:meetingDatesTable:6:j_idt310_items">
    <div class="ui-helper-hidden-accessible">
        <input id="meetingDatesForm:meetingDatesTable:6:j_idt310_focus" name="meetingDatesForm:meetingDatesTable:6:j_idt310_focus" type="text" autocomplete="off" aria-expanded="true" aria-autocomplete="list" aria-activedescendant="meetingDatesForm:meetingDatesTable:6:j_idt310_2" aria-describedby="meetingDatesForm:meetingDatesTable:6:j_idt310_2" aria-disabled="false">
        </div>

        <div class="ui-helper-hidden-accessible">
            <select id="meetingDatesForm:meetingDatesTable:6:j_idt310_input" name="meetingDatesForm:meetingDatesTable:6:j_idt310_input" tabindex="-1" aria-hidden="true">
                <option value="" data-escape="true">Select one...</option>
                <option value="3" data-escape="true">Board</option>
                <option value="140" selected="selected" data-escape="true">Commission S</option>
                <option value="2" data-escape="true">Commission I</option>
                <option value="219" data-escape="true">Commission F</option>
            </select>
        </div>
        <label id="meetingDatesForm:meetingDatesTable:6:j_idt310_label" class="ui-selectonemenu-label ui-inputfield ui-corner-all">Commission S</label>

//on selecting the dropdown button the below code gets hightlighted
        <div class="ui-selectonemenu-trigger ui-state-default ui-corner-right">
            <span class="ui-icon ui-icon-triangle-1-s ui-c"/>
        </div>
    </div>
</div>

Can some one please help

***** Update*** html *** I also see this for the drop down selection and this tag gets highlighted

<div class="ui-selectonemenu-items-wrapper" style="max-height:200px">
    <ul id="meetingDatesForm:meetingDatesTable:6:j_idt310_items" class="ui-selectonemenu-items ui-selectonemenu-list ui-widget-content ui-widget ui-corner-all ui-helper-reset" role="listbox" aria-activedescendant="meetingDatesForm:meetingDatesTable:6:j_idt310_2">
        <li class="ui-selectonemenu-item ui-selectonemenu-list-item ui-corner-all" data-label="Select one..." tabindex="-1" role="option" id="meetingDatesForm:meetingDatesTable:6:j_idt310_0">Select one...</li>
        <li class="ui-selectonemenu-item ui-selectonemenu-list-item ui-corner-all" data-label="Board" tabindex="-1" role="option" id="meetingDatesForm:meetingDatesTable:6:j_idt310_1">Board</li>
        <li class="ui-selectonemenu-item ui-selectonemenu-list-item ui-corner-all ui-state-highlight" data-label="Commission S" tabindex="-1" role="option" id="meetingDatesForm:meetingDatesTable:6:j_idt310_2">Commission S</li>
        <li class="ui-selectonemenu-item ui-selectonemenu-list-item ui-corner-all" data-label="Commission I" tabindex="-1" role="option" id="meetingDatesForm:meetingDatesTable:6:j_idt310_3">Commission I</li>
        <li class="ui-selectonemenu-item ui-selectonemenu-list-item ui-corner-all" data-label="Commission F" tabindex="-1" role="option" id="meetingDatesForm:meetingDatesTable:6:j_idt310_4">Commission F</li>
2
  • please add the exception stack trace – PDHide Feb 11 at 8:20
  • org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with (sometimes I get this)... – sandy Feb 11 at 8:30
0

your selector looks valid , if the error is not visible use webdriver wait.

first scroll to that element:

  ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView()", dropdownelement);
   

then wait for the visibility:

WebDriverWait wait = new WebDriverWait(webDriver, DURATION.second);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(yourlocator)));

Update:

your locator is wrong use select class as its a selct dropdown

Select objSelect = new Select(driver.findElement(By.id("id="meetingDatesForm:meetingDatesTable:6:j_idt310_input"")));
Select.selectByIndex(4);
10
  • let me try and revert – sandy Feb 11 at 8:42
  • @sandy please accept the answer by clickign the tick sign if it helps – PDHide Feb 11 at 8:43
  • trying still not working – sandy Feb 11 at 8:47
  • whats the error – PDHide Feb 11 at 8:48
  • same thing org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with – sandy Feb 11 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.