Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with taking screen shots of individual components #62

Closed
BRawitt00 opened this issue Aug 12, 2020 · 11 comments
Closed

Issue with taking screen shots of individual components #62

BRawitt00 opened this issue Aug 12, 2020 · 11 comments

Comments

@BRawitt00
Copy link

I am unable to capture individual elements with 'Capture Element'. The same element from the same html page can be captured on an associate's machine. Robotframework, robotframework robot-eyes, and selenium are all the same version. I can capture the element when using the selenium library built in 'Capture Element Screenshot' followed by the xpath to the button. I have tested this with numerous elements, all result in blank screenshots.

I cannot give the html to this page as it is confidential, but here are the steps.

  1. Picked a button on the html page
  2. Inspected the element with developer tools on chrome to confirm the buttons info.
  3. Created a robotframework test
  4. The test opened the browser, navigated to the URL, and then ran this line
    'Capture Element css=app-text-file > mat-toolbar > button:nth-child(6)'
  5. This line has been run with the '>' and a space instead.

The expected behavior is for a screenshot to be taken properly.

I have attached an image of the visual report containing no screenshot.
image

  • OS: macOS Catalina v:10.15.6
  • Browser: Chrome
  • Version: 84.0.4147.105
  • tested on current firefox version as well, same OS

Thank you.

@jessezach
Copy link
Owner

jessezach commented Aug 12, 2020

@BRawitt00 I normally test the library on Mac OS Mojave. Can you confirm if your colleague is also on Catalina OS as well? Also would you be able to share your testcase with me just so I can confirm there's nothing missing.

I was not aware that selenium now comes with the ability to capture element screenshot. The library captures a full page screenshot and crops the element out based on its coordinates. Looks like I can now utilize selenium's API to achieve this instead. I will release a fix tomorrow. That should probably resolve your issue

@jessezach
Copy link
Owner

@BRawitt00 I investigated this a bit and it looks like capture element screenshot is relatively new and supported only on latest version of browsers.
I'm not sure if your issue is related to screenshot getting captured. It seems from your screenshot that a diff image is getting generated. It could be that the actual image is captured but not showing up in the report. However I can only help you out at this point if you could provide me with some more information.

  • Could you navigate to the <results folder>/visual_images/actual/<test_case>/ folder and check if you can see the image that you're trying to capture?

@BRawitt00
Copy link
Author

@BRawitt00 I normally test the library on Mac OS Mojave. Can you confirm if your colleague is also on Catalina OS as well? Also would you be able to share your testcase with me just so I can confirm there's nothing missing.

I was not aware that selenium now comes with the ability to capture element screenshot. The library captures a full page screenshot and crops the element out based on its coordinates. Looks like I can now utilize selenium's API to achieve this instead. I will release a fix tomorrow. That should probably resolve your issue

Yes I can confirm my colleague is also on Catalina.

My test case code is as follows:

Test Screenshot
Open Eyes SeleniumLibrary
Create New File With Name testFile.pmd
Reload Page
Click On My Files
Click On Item By Name testFile.pmd
Capture Element css=app-text-file > mat-toolbar > button:nth-child(6)
Compare Images

For this test case several of these are user defined key words. They simply perform actions that have many steps to create the files necessary to get to the page where the screen shot will be taken. They are executed correctly and mostly consist of steps like 'Click Element' 'Wait Until Element Is Visible' 'Input Text' 'Click Element' etc.

@BRawitt00
Copy link
Author

@BRawitt00 I investigated this a bit and it looks like capture element screenshot is relatively new and supported only on latest version of browsers.
I'm not sure if your issue is related to screenshot getting captured. It seems from your screenshot that a diff image is getting generated. It could be that the actual image is captured but not showing up in the report. However I can only help you out at this point if you could provide me with some more information.

  • Could you navigate to the <results folder>/visual_images/actual/<test_case>/ folder and check if you can see the image that you're trying to capture?

No problem. I can try and provide whatever additional information you need. This path, leading finally to my test case, was empty.

@jessezach
Copy link
Owner

@BRawitt00 I see. Was the test case folder not created either?

@BRawitt00
Copy link
Author

@BRawitt00 I see. Was the test case folder not created either?

The folder for the test case 'Test_Screenshot' was created and in the path you listed, it was simply empty.

@jessezach
Copy link
Owner

jessezach commented Aug 13, 2020

@BRawitt00 Understood. You're right. The image does not seems to have been saved. I might have to upgrade my OS to Catalina to reproduce this. Could you help me with a couple more information?

  • Do you see any exception being thrown in the capture element keyword in the report?
  • Is your Macbook model one of the latest ones? Could you confirm if your colleague uses the same model as well?

@BRawitt00
Copy link
Author

@BRawitt00 Understood. You're right. The image does not seems to have been saved. I might have to upgrade my OS to Catalina to reproduce this. Could you help me with a couple more information?

  • Do you see any exception being thrown in the capture element keyword in the report?
  • Is your Macbook model one of the latest ones? Could you confirm if your colleague uses the same model as well?

No exceptions are being thrown anywhere during the Test_Screenshot test case. The laptops we are currently using are distributed by our employer so I believe they are all the same. They are MacBook Pro 15 inch, 2019.

@jessezach
Copy link
Owner

@BRawitt00 I'm not really sure as to what could be causing this issue. I will try to reproduce this after upgrading to Catalina.

@BRawitt00
Copy link
Author

@BRawitt00 I'm not really sure as to what could be causing this issue. I will try to reproduce this after upgrading to Catalina.

Cool. Thanks for trying. I'm at a loss myself as to what is causing this.

@jessezach
Copy link
Owner

Closing this due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants