0

I am trying to have Python, Chrome and ActionChains to save a webpage.

The code seemed like ever works fine on an computer but not another.

I checked the code and also tried the suggestions gave at selenium action chains no effect, but it still doesn't work.

Where went wrong? thanks.

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
import win32com.client as comclt

chromedriver = "c:\Python27\\chromedriver.exe"
os.environ["webdriver.chrome.driver"] = chromedriver

driver = webdriver.Chrome(chromedriver)
driver.maximize_window()

aaa = driver.get("https://sg.yahoo.com/?p=us")
time.sleep(3)

save_me = ActionChains(driver).key_down(Keys.CONTROL).key_down('s').key_up(Keys.CONTROL).key_up('s')
save_me.perform()
time.sleep(2)
wsh= comclt.Dispatch("WScript.Shell")
wsh.AppActivate("chrome")
time.sleep(1)
wsh.SendKeys("{ENTER}")

driver.quit()
Dharman
  • 30,962
  • 25
  • 85
  • 135
Mark K
  • 8,767
  • 14
  • 58
  • 118

1 Answers1

0

it seems like the versions for Chrome and Chromedriver (32-bit, 64-bit) matter. Tried another version it may work fine.

Mark K
  • 8,767
  • 14
  • 58
  • 118