• Register
1 vote
77 views

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")

 actions.move_to_element(myelement)

 actions.sleep(.1)

 actions.click()

 actions.perform()

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 :

EC.visibility_of_element_located

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

 

OR

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

MYDRIVER.find_element_by_name("file_u").send_keys("/tmp/img.png")

9 7 4
38,600 points

Related questions

0 votes
0 answers 18 views
18 views
Problem: I'm refering about stuff like logon, searchs and open menu with dropdown. Sometimes, when I execute this codes in Firefox I receive this message: "raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotInteractableException: Message: " or "selenium ... ("Best Friend Profile").click() Browser Version: 59.0.3071.115 (Google Chrome) and 52.2.1 (Firefox)
asked May 1 nabin shrestha 4.3k points
0 votes
1 answer 15 views
15 views
Problem: Trying to get selenium to work with Python 3 for web scraping purposes: from selenium import webdriver chrome_path = r"/Library/Frameworks/Python.framework/Versions/3.6/bin/chromedriver" driver = webdriver.Chrome(chrome_path) I get the following error message: selenium.common ... my system. The other asker apparently didn't have it on their computer. I'm running latest version of Mac OS.
asked Apr 24 sumaiya simi 43.9k points
0 votes
1 answer 15 views
15 views
Problem: I've seen this issue around, but, unfortunately, I have struggled to find a definite resolution. Perhaps, if someone has it working for themselves, they could share what firefox and geckodriver combination they have it working with. Edit: I am running ... 0.26.0 (for linux64; downloaded from here: github.com/mozilla/geckodriver/releases) org.seleniumhq.selenium:selenium-server:3.4.0
asked Apr 24 sumaiya simi 43.9k points
0 votes
1 answer 4 views
4 views
Question: Is there any way I can change selenium firefox settings, so whenever i click a button on website that links to another website for example, that link opens in new tab, not new window? I tried making custom profile, but it never worked for me.. always loads with anonymous one. Any help is well appreciated.
asked Apr 12 Atik03 26.5k points
0 votes
1 answer 3 views
3 views
Problem: I have been tasked with writing a parser to click a button on a website and I am having issues to click only one of the buttons. I am getting this error. ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with
asked Mar 27 ummesalma 29.2k points
1 vote
1 answer 14 views
14 views
Problem : Why I got the error : Exception in thread "main" java.lang.IllegalStateException: The driver executable does not exist: C:\Users\Scott\workspace\Twitch%20Bot%20v2\bin\chromedriver.exe at com.google.common.base.Preconditions.checkState(Preconditions.java:197) at org.openqa.selenium ... chromedriver and it's there. I'm not sure what the problem is at this point. Any help would be great!
asked Apr 5 Sabbir Hossain 14.6k points
0 votes
1 answer 3 views
3 views
Problem: Tell me the difference between action and actions in selenium webdriver.
asked 4 days ago Irenka Kiri 17.9k points
0 votes
1 answer 4 views
4 views
Problem: This is the code of selenium code to open the chrome browser and closing it. import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.By; public class TC001_Login_Logout { ... .Class.getMethod(Unknown Source)at sun.launcher.LauncherHelper.getMainMethod(Unknown Source). at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
asked May 2 anika11 32.2k points
0 votes
1 answer 24 views
24 views
Problem: I came across this problem > What is the unit of movements string argument in drag&drop selenium action
asked May 1 ummeshani 10.8k points
0 votes
1 answer 5 views
5 views
Problem: I'm using Selenium WebDriver, how can I check if some text exist or not in the page?
asked Apr 27 Jack20 5.1k points