maaaaz / webscreenshot

A simple script to screenshot a list of websites
GNU Lesser General Public License v3.0
654 stars 162 forks source link

Ajax actions before taking the snapshot #18

Closed fiuderazes closed 4 years ago

fiuderazes commented 5 years ago

Would it be possible to perform an action before taking the snapshots? For e.g. clicking a button inside the webpage to show some hidden information

" def lookup(driver): driver.get("url") try:

box = driver.wait.until(EC.presence_of_element_located((By.NAME, "q")))

    #button = driver.find_element_by_class_name('oc-home-search__button')
    button = driver.find_element_by_id('showPhone')
    #box.send_keys(query)
    button.click()

    image = driver.find_element_by_class_name('telnumber')
    print(image.get_attribute('element'))
    abc = driver.FindElement(By.XPath("//div[contains(@style, 'background-image'))
    #print(image.get_attribute("url"))

except TimeoutException:
    print("Box or Button not found!")
maaaaz commented 4 years ago

Hello @Tudorvr, From your code I understand that you need a webdriver: this is currently not supported.

Cheers.

maaaaz commented 3 years ago

cf. https://github.com/maaaaz/webscreenshot/issues/34#issuecomment-678767976