• Register
1 vote

Problem :

I am working on the task for writing the parser to click the button on the website and I am having trouble in clicking the only one of the buttons. The below is my code which works on every button except one.

My python code:

 driver = webdriver.Firefox() 


 myelement = driver.find_element_by_id("-spel-nba")





I am facing below error :

ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with

I also tried the waits with the same element but facing not visible exception:

wait = WebDriverWait(driver, 10)

wait.until(EC.presence_of_element_located((By.XPATH, "//input[contains(@id,'spsel')][@value='nba']"))).click()

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

The solution for you as below :

myelement  = WebDriverWait(driver, 3).until(EC.visibility_of_element_located((By.XPATH, xpaths['your_xpath_path'])))

The actual trick is to use as below :


Along with the WebDriverWait

And WebDriverWait

from the below mentioned imports :

from selenium.webdriver.support import expected_conditions as EC

from selenium.webdriver.support.ui import WebDriverWait



If "The Element is not currently visible to you " then just make it VISIBLE programmatically as below:

>>> Before the element is hidden and the  top is outside of page

<input type="file" style="position: absolute;top:-999999" name="file_u">

>>> After moving the top on in page area

MYDRIVER.execute_script("document.getElementByName('file_u').style.top = 0;")

time.sleep(1); # give some time to render the page


9 7 4
38,600 points

Related questions

0 votes
1 answer 14 views
I am finding a program that will help me to handle multiple windows in Selenium Webdriver.
asked Oct 5, 2020 Daniel Anderson 4k points
0 votes
1 answer 14 views
0 votes
1 answer 18 views
Problem: I am very new to Selenium and Java both. I am trying to select and get the dropdown value in a Selenium WebDriver using the Java. The HTML Code is as below: <select class="form_input_select bx-def-font" name="Sex[0]"> <option value="Male">Man</option> < ... it only shows _Others Kindly help me to solve above issue. I am unable to fix above issue after working on it for more than 3 days.
asked Jul 9, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 121 views
Problem : I am trying to learn the Selenium by myself. But now my Sendkeys is not working. Can anybody please help me to fix my issue. My code is as below: WebElement uname = driver.findElement(By.xpath("//*[@id='username']"));      uname.sendKeys("123456"); Below is the error: Exception in ... ip: '', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_161'
asked Feb 14, 2020 mphil 2.3k points
0 votes
1 answer 217 views
Problem : I am trying to develop some selenium tests which should run with headless firefox but the following error suddenly popped up in my server.log file when I was trying to connect to the webdriver via following command: driver = webdriver.Firefox(firefox_profile = profile, log_path = ... spec as below: python 2.7.12, Firefox: Mozilla Firefox 57.0.3, geckodriver: 0.19.1, selenium: 3.8.0
asked Dec 3, 2019 alecxe 7.5k points
0 votes
2 answers 471 views
Problem : I want to set up the multiple setting files (e.g. Dev, Prod, ..) that include some base settings also. But unable to gain successes in my goal. Whenever I am trying to run my ./manage.py runserver I ... == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cb.settings.development") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
asked Dec 5, 2019 alecxe 7.5k points
0 votes
1 answer 12 views
We have a table with 4 columns. The first is name of the Product. The second column is a dropdown, in which it should be selected the product that showing this product list from the first column and the other values in this dropdown should be other category and it could change product category.
asked Sep 25, 2020 Daniel Anderson 4k points
0 votes
1 answer 71 views
Problem: I think my Jenkins would ssh in and execute the commands described in a specific job which is running. Currently I want to run my Selenium Webdriver tests but unfortunately it informs me that I have many errors while trying to launch the firefox. I am also ... 45000 ms. Firefox console output: [testng] Xlib: connection to ":0.0" refused by server [testng] Xlib: No protocol specified
asked Jul 11, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 700 views
Problem : I am trying to invoke the testng programmatically. And not the eclipse plug-in. I have associated the "testng-6.8.21.jar" and I am running it through eclipse and I tried to run below code: import org.testng.TestNG; public ... .ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more
asked Jan 31, 2020 jwilliam 3.9k points
0 votes
2 answers 1.2K views
Problem : I have the list which has the multiple links under each section. Each section has the same links I need to click the particular link under each section. I have written my code for it but when I execute the code it gives me below error: Exception in thread "main" org.openqa.selenium.StaleElementReferenceException: stale element reference: element is not attached to the page document
asked Jan 18, 2020 jwilliam 3.9k points