How to get to a select element when its hidden?

Usually when I want to use a select element its pretty simple, I just go:

val selectCompany = new Select(driver.findElement(By.cssSelector("#company_id")))
selectCompany.selectByValue("975")

But in my case it dosen't work...

this is the html (the relevant part):

But I get error using the css selector, this is the error:

Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with Command duration or timeout: 60 milliseconds

I tried to add Wait element but still not working...

I guess the issue is that the select element is hidden, can someone please helpppp

thanks

Answers


Execute this script before you try to find the element; something like this. Hope this help

((JavascriptExecutor) driver).executeScript(" document.getElementById('company_id').style.visibility = 'visible'; ");

Need Your Help

Customizing JQuery autocomplete to add Static HTML content before and after the list

jquery autocomplete customization jquery-autocomplete

Hey i need to add HTML content before and after the list that is dynamically generated using the autocomplete........the following is my code snippet..i have tried append, prepend to li but no luck...

Benefits of differential lists with lazy evaluation

performance haskell

I struggle to understend why ++ is considered O(n) while differential lists are considered "O(1)".