I try to use your library to make screenshot but I don't succeed to choose the size.
html2canvas(document.body, {width:200, height:200}).then(function(canvas) {
document.body.appendChild(canvas);
});
Can I do it ?
Related
So I'm writing e2e test for an app and I have a method to fill up an input
static async fillInput(el, text = this.randomString()) {
await el.click();
await el.clear();
await el.sendKeys(text);
}
It works great. Well it worked great until I tried it on a field that appeared after clicking on a button. I got a Failed: element not interactable: element has zero size. Okay, maybe I4m a little hurry, so my function was updated to be that
async fillEmail() {
const newEmail = CommonMethods.createRandomEmail();
const emailElement = element(by.css('.block-info input[name="email"]'));
await browser.wait(protractor.ExpectedConditions.elementToBeClickable(emailElement));
await browser.sleep(5000)
await CommonMethods.fillInput(emailElement, newEmail);
return newEmail;
}
I reaaaaally thought it was a delay thing. But no. protractor.ExpectedConditions.elementToBeClickable pass, but fillInput failed with the same error while trying to click on the element.
I checked the css properties too, founc out line-height and font-size are set to inherit and parent has everything set up. width and max-width are set to 100%, element is clearly visible and I can click on it anywhere to get the focus.
Anyone has an idea ?
I have an image that is in landscape mode.
This is the image.
Now I need to convert it to portrait. i.e it should be like this.
And the image should be saved in the app directory. (saving part I know.just to complete the question)
How can I do that in flutter.
I use the lib image (https://pub.dev/packages/image) and you can call this code on a button action :
import 'package:image/image.dart' as ImageLib;
try {
File contrastFile = File(imagePath);
ImageLib.Image contrast =
ImageLib.decodeImage(contrastFile.readAsBytesSync());
contrast = ImageLib.copyRotate(contrast, -90);
contrastFile.writeAsBytesSync(ImageLib.encodeJpg(contrast));
setState(() {
imageCache.clear();
imageCache.clearLiveImages();
reload();
});
} catch (e) {
print(e);
}
I am new to industry and looking for assistance to test switching fullscreen on / off using protractor.
Like for example click to turn full screen on and click to turn full screen off.
I googled a bit and only found the following which is setting the browser to default full screen but not what I am looking for
browser.manage().window().maximize();
Appreciate any suggestions
If you are using chrome/chromium need to add in protractor config flag:
export const config = {
capabilities: {
chromeOptions: {
args: ['--start-fullscreen']
}
}
}
You may be able to achieve this functionality by getting the current size of the screen, maximizing and then comparing to your original size.
let currentSize = await browser.manage().window().getSize();
console.log('current size: ', currentSize);
await browser.manage().window().maximize();
let maximisedSize = await browser.manage().window().getSize();
console.log('max size: ', maximisedSize);
if (currentSize !== maximisedSize) console.log('Window was not maxmized')
I haven't used the .then syntax in a while but you should be able to achieve similar functionality with
browser.manage().window().getSize().then(originalSize => {
browser.manage().window().maximize().then(() => {
browser.manage().window().getSize().then(newSize => {
if(originalSize !== newSize) console.log('Window was not maxmized');
})
})
});
If there is any element on the screen to turn full screen ON, then you can simply click it or use following code:
await browser.executeScript('document.documentElement.requestFullscreen();');
And, to exit the full screen you can use document object as:
await browser.executeScript('document.exitFullscreen();');
OR
await browser.executeScript('document.webkitExitFullscreen()');
Is there a way to determine the available screen size/resolution using Protractor?
I want to determine how big to make several browsers, and where to place them.
I know you can get/set window size using:
browser.driver.manage().window().setSize(1280, 1024);
browser.driver.manage().window().getSize();
But I can't find anything in the docs about available screen size/resolution.
I ended up using browser.executeScript to access the screen object.
browser.executeScript('return {' +
'height: screen.availHeight,' +
'width: screen.availWidth,' +
'top: screen.availTop,' +
'left: screen.availLeft};'
)
.then(function (result) {
//make calculations
browser.driver.manage().window.setSize(h,w);
browser.driver.manage().window.setPosition(x,y);
});
After detail search and googling I finally decide to put my question.
In my JQM web app there are total 4 pages. 2 of them are dynamically populated via Ajax. I have used
$.extend($.mobile, {
defaultPageTransition: 'none'
});
My dynamically populated function is
$.get_detail= function(){
$.ajax({
url: "mypage.cfm",
data: data,
timeout:5000,
cache:false,
type:'GET',
dataType:"html",
success: function(data3) {
//$('#filldiv').empty();
$("#filldiv").html(data3);
$.mobile.changePage('#detailpage');
},
error: function(statusCode, errorThrown)
{
if (statusCode.status == 0)
alert("you are offline");
else
alert("Please try again.");
}
});
}
When I change page flash white screen just like flicer happened but when there is no data fill in div then there is no flicker. I have noticed that, if there is no screen size change then every thing is okay and if screen size change by filling the dynamic content flicker happen
Please help me out to solve this issue. Thank you
Here's what I'm using to disable default transitions:
$(document).on( "mobileinit", function() {
$.mobile.defaultPageTransition = 'none';
});
The newest version 1.4, is also supposed to help with better transitions.