testcafe
testcafe copied to clipboard
Scrolling to the top of page occurs before taking screenshot by takeElementScreenshot
What is your Test Scenario?
To take a screenshot of an element
What is the Current behavior?
The incorrect page area screenshot is taken by takeElementScreenshot due to scrolling to the top of the page
What is the Expected behavior?
The element screenshot is taken
import { Selector } from 'testcafe'
fixture`Tmp`.page`https://www.w3schools.com/js/default.asp`
test(`Tmp`, async (t) => {
const label = Selector('h2').withExactText('Learning Speed')
await t.hover(label)
await t.takeElementScreenshot(label, 'element.png')
})
Your complete configuration file (if any):
{
"src": ["src/specs/**/*.ts"],
"browsers": ["browserstack:chrome"],
"tsConfigPath": "./tsconfig.json",
"screenshots": {
"path": "./screenshots/",
"pathPattern": "${DATE}_${TIME}/${TEST}/${USERAGENT}/${FILE_INDEX}.png",
"takeOnFails": false,
"fullPage": true
},
"debugOnFail": false,
"concurrency": 1,
"pageLoadTimeout": 30000,
"selectorTimeout": 10000,
"assertionTimeout": 30000,
"reporter": [
{
"name": "spec"
},
{
"name": "xunit",
"output": "reports/test-results/results.xml"
}
]
}
Actual result:
Expected result:
Note:
It works correctly on browserstack
Your Environment details:
- testcafe version: 1.9.3, 1.15.1
- node.js version: 14.15.0
- command-line arguments: dotenv -- testcafe chrome src/specs/tmp.ts
- browser name and version: Chrome 92
- platform and version: Windows 10
Hi,
Thank you for your input. We have reproduced the problem and need some time to investigate it, please stay tuned.
I have noticed that reason is screenshots.fullPage:true of .testcaferc.json config. Screenshot works correctly on local browser without this, and sometimes the entire page is screenshotted on BrowserStack with if this parameter is defined
This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.
We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.