'How to interact with excel file in excel web app using selenium(mac os, python)?
I am trying to modify a real time excel file in web browser. The reason I am going through the web browser is because the file is stored in a sharepoint folder. In order to have real time changes show, I need to input data as if I were logged in to an organization account.
I have a script that uses selenium to log in to my organization account, but I am having a lot of trouble finding ways that selenium can interact with cells/sheets after getting to the excel workbook in web browser.
from ast import Return
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
import time
PATH = "PATH"
driver = webdriver.Chrome(PATH)
#LINK TO WEB BROWSER WORKBOOK
driver.get("SHAREPOINT LINK")
print(driver.title)
time.sleep(5)
search = driver.find_element(By.NAME, "loginfmt")
search.send_keys("EMAIL")
search.send_keys(Keys.RETURN)
time.sleep(5)
search = driver.find_element(By.NAME, "Password")
search.send_keys("PASSWORD")
search.send_keys(Keys.RETURN)
time.sleep(15)
#This command and the next one do not work. Selenium cannot locate these and I am not sure how to locate the sheets/cells once in web browser view of excel.
search = driver.find_elements_by_css_selector(".tab-active .tab-content-container")
search.click()
time.sleep(5)
search = driver.find_element_by_css_selector("#formulaBarTextDivId_textElement > .ewa-rteLine")
search.send_keys("testing")
search.send_keys(Keys.RETURN)
time.sleep(15)
driver.quit()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
