Skip to content

AttributeError: 'WebElement' object has no attribute 'get_screenshot' #73

@mzbedat

Description

@mzbedat

Hi,
I started looking into needle (instead of ApliTools) and trying to create a test but facing an issue with this command:
element.get_screenshot().save(baseline_file)
In compareScreenshot() method cases.py file

File "C:\Python27\lib\site-packages\needle\cases.py", line 238, in compareScreenshot
element.get_screenshot().save(output_file)
AttributeError: 'WebElement' object has no attribute 'get_screenshot'

My guess that the driver that am referring to is the selenium web driver, but the one used in cases.py is the needle driver!

My code:

from needle.cases import NeedleTestCase

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

from time import sleep

class NebulaTest(NeedleTestCase):
def init(self):
self.output_directory = "C:\screenshots"
self.baseline_directory = "C:\screenshots\baseline"
#self.engine_class = 'needle.engines.perceptualdiff_engine.Engine'
#engine_class = 'needle.engines.imagemagick_engine.Engine'

    self.driver = webdriver.Chrome()
    self.test_feedback()
    
def test_feedback(self):
    
    #self.set_viewport_size(width=1024, height=768)
    
    self.driver.get('https://kampyle25.tumblr.com/')
    
    sleep(5)
    #try:
    #    WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, "div.kampyle_button-text")))
    #finally:
    #    self.driver.quit()
    
    self.assertScreenshot('div.kampyle_button-text', 'feedback')

NebulaTest()

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions