-2

So I am making a Magic Mirror for my CPS class, and I made it so it will have multiple displays using browser tabs in fullscreen mode. For one of the displays, I wanted to have the embedded Google Calendar scaled to fit my 27 inch monitor (which Google supplies from the Calendar settings). The calendar works when I open it in Firefox normally, but when Firefox is opened with geckodriver using selenium, the calendar shows up, but in its generic state, and there is no way to edit it. I have tried opening the .html page in other browsers and they all work. This is what it looks like: GeckoDriver Display, FireFox Display. The Calendar involves using an iframe tag, which I have tried changing to an object tag with the same result. Here is the iframe code:

<iframe src="https://calendar.google.com/calendar/embed?showTitle=0&amp;showDate=0&amp;showPrint=0&amp;showTabs=0&amp;
showCalendars=0&amp;height=1810&amp;wkst=1&amp;bgcolor=%23000000&amp;src=tvanderlinden8%40gmail.com&amp;color=%2329527A&amp;
src=%23contacts%40group.v.calendar.google.com&amp;color=%2329527A&amp;src=en.usa%23holiday%40group.v.calendar.google.com&amp;
color=%2329527A&amp;ctz=America%2FNew_York" style="border-width:0"width="1000" height="1800" frameborder="0" scrolling="no"></iframe>

Along with my Python opening each html file:

# Imports
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

# Create new browser and open all display tabs

# Open Firefox dir
driver = webdriver.Firefox()

# Open google tab
driver.get('http://google.com')
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')

# Open MagicMirror.html, MagicMirror2.html, and MagicMirror3.html (all 3 displays)
driver.get('/home/pi/Desktop/MagicMirror/MagicMirror.html')
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')
driver.get('/home/pi/Desktop/MagicMirror/MagicMirror2.html')
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 't')
driver.get('/home/pi/Desktop/MagicMirror/MagicMirror3.html')

# Close google tab
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + Keys.TAB)
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + 'w')
# Set webpage to full screen
driver.find_element_by_tag_name('body').send_keys(Keys.F11)

# Variable used to determine if display is showing 1st or 3rd display
disNum = 1

# Input to change display
while(True):
    display = int(input("Please select a display: "))

    # Moves right a display unless it is at the last display
    if (display == 1 and disNum != 3):
         driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + Keys.TAB)
         disNum += 1

    # Moves left a display unless it is at the first display
    if (display == 2 and disNum != 1):
        driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + Keys.SHIFT + Keys.TAB)
        disNum -= 1

There are no Errors since it does "work" in a way. It just doesn't work the way I need it to.

1 Answers1

0

I figured out a solution that works perfectly.

<object data="https://calendar.google.com/calendar/embed?showTitle=0&amp;showNav=0&amp;
showDate=0&amp;showPrint=0&amp;showTabs=0&amp;showCalendars=0&amp;showTz=0&amp;height=1400&amp;
wkst=1&amp;bgcolor=%23000000&amp;src=tvanderlinden8%40gmail.com&amp;color=%2329527A&amp;
data=%23contacts%40group.v.calendar.google.com&amp;color=%2329527A&amp;
src=en.usa%23holiday%40group.v.calendar.google.com&amp;color=%2329527A&amp;
ctz=America%2FNew_York" style="border-width:0" width="1000" height="1820"></object>

You're suppose to change all 'src's to 'data', but I found if you only change the beginning and for %23contacts%... to 'data' fixes the problem. Make sure you are logged into your Google acount as well so it can retrieve your Calendar data.