Python Forum
Selenium - "Element is not currently visible and may not be manipulated"
Thread Rating:
  • 2 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selenium - "Element is not currently visible and may not be manipulated"
#1
Hi,

I have been working on the following code to scrape data from the website for my research. However, I got the following error message. "errorMessage":"Element is not currently visible and may not be manipulated"

When I try out each line of the code on the Python interpreter, they would work fine. However, when I save the code as scrapeEcoData_weekly.py and run the file, that's when I get the error message.

from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.webdriver.common.by import By
import time

driver = webdriver.PhantomJS(executable_path='C:/Users/AppData/Local/Programs/Python/Python35-32/myScript/Misc/PhantomJS')
driver.get("https://www.dailyfx.com/calendar")

weeklyView = driver.find_element_by_xpath('//*[@class="btn btn-default webinar-hover dfx-has-spinner hidden-xs"]')
weeklyView.click()
time.sleep(10)
pageSource = driver.page_source
bsObj = BeautifulSoup(pageSource, "html.parser")
tblTag = bsObj.findAll("table", {"class":"table dfx-calendar-table tab-pane fade in active "})[0]
tRows = tblTag.findAll("tr")
for index, item in enumerate(tRows):
print("index: ", index, " ", "item: ", item.get_text())
I tried to locate the "Weekly View" button element using the code instead. The codes would run fine. I took a screenshot of the website after weeklyView.click(), the weekly page didn't show up. It was still showing the daily page as if the button was never clicked on.

weeklyView = driver.find_element_by_xpath('//*[contains(., "Weekly View")]
However, if someone could help me with this.
Thank you!
Reply


Messages In This Thread
Selenium - "Element is not currently visible and may not be manipulated" - by tkj80 - Oct-26-2016, 11:10 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Selenium suddenly fails to find element Pavel_47 3 6,522 Sep-04-2022, 11:06 AM
Last Post: Pavel_47
  Clicking on element not triggering event in Selenium Python (Event Key is not in data dkaeloredo 2 4,366 Feb-16-2020, 05:50 AM
Last Post: dkaeloredo
  Selenium locating an element. JokerTux 3 2,789 Dec-28-2019, 08:50 AM
Last Post: snippsat
  Selenium returning web element instead of desired text newbie_programmer 1 5,295 Dec-11-2019, 06:37 AM
Last Post: Malt
  How to get visible text of Select Drop down ankitjindalbti 2 2,838 Jun-03-2019, 12:35 AM
Last Post: ankitjindalbti
  Python Selenium getting table element trengan 2 8,671 Dec-31-2018, 03:02 PM
Last Post: trengan
  Click Element if displayed using Selenium and Python giaco__mar 1 3,606 Dec-27-2018, 06:19 PM
Last Post: metulburr
  Selenium stale element reference test 1 2,829 Sep-19-2018, 10:19 PM
Last Post: test
  Simple Element Check Code in Selenium Not Working digitalmatic7 1 3,065 Feb-18-2018, 06:53 AM
Last Post: metulburr
  Selenium - Googlemaps element not visible Barnettch3 3 5,757 Jan-15-2018, 08:07 PM
Last Post: Barnettch3

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020