I understand that the screenshot functionality basically works as painting the DOM. Since the URL is not part of the DOM, the screenshot does not contain the URL. But is there any workaround to capture the URL as part of the screenshot?
Currently it is not possible with webdriver.
You can follow any of the below approaches. (You did not mention the programming language. These examples are in Java.)
1. Capture current desktop screen
Robot has createScreenCapture method. So, I would go with that & It is very easy to implement.
Robot robot = new Robot();
BufferedImage screenShot = robot.createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
ImageIO.write(screenShot, "JPG", new File("ScreenShot.jpg"));
2. You can write the URL in the image.
This might be an annoying approach sometimes as it might hide information in the image. But this too is very easy to implement.
Check this answer
3. Add the current URL to the image as meta data
Check this answer
Absolutely correct, getting URL in the screen-shot is yet not possible in Selenium and here are the reference Link which tells the same. But as a part of workaround what i can suggest you is to first get the screen shot using
robot.keyPress(KeyEvent.VK_PRINTSCREEN);
Remember this workaround might became time consuming if more number of screen shots has to be taken but can be efficient if you want only one screen shot in single run of your AUT. Second once you copy the screen shot in your clipboard it again depends on you how you want to automate it further, By using Third party tool like Sikuli you can easily integrate it with selenium.
As this is a workaround i would not guarantee success.
Related
I need a clarification. Today I bought a new Android 10 Samsung device to test apps... and all captured images are shown rotated wrongly inside the Labels. The code is very minimal: takes a photo and then shows it in a Label. It works fine on my iPhone and my old Android device, but in this new Android device the image orientation is not detected correctly by Codename One.
Is it a bug of Codename One or is it something that needs coding in the app?
In the latter case, can you give us a code to take photos in the correct orientation? Thank you.
I think there might already be an issue on that, if not there should be. The gist of it is this... Some modern phones always take the photos in the same orientation and just mark the photo as rotated to X degrees in its tags.
This works usually since most apps know to show the photo rotated. Currently we have a workaround for that in the gallery API but that's a bad workaround. A good workaround would be to check that flag every time we load an image and rotate it dynamically. It would be inefficient but it would solve that problem once and for all.
I created a PeerComponent, that is a port in Codename One of the Horizon Camera SDKs. At the moment, it simply shows a live-preview of the camera.
I tried to add a Label over the PeerComponent: the Label is on top only in Android. On iOS, the Label is on bottom (that means invisible).
I've done a lot of trials to get a correct z-ording on iOS, without success.
My question is which tips, suggestions or checks can I do to make z-ordering working properly on iOS also. Thanks.
Normally it should "just work", there is no special treatment. I think horizon paints in an area we rely on and doesn't paint when we expect it to. Looking at their sample code I see that they reference top and bottom elements which might allow working around this.
We all go Back, but never go Forward?
I'm working on a new project with the just released Xamarin.Forms and I have hit a wall in my development process.
The goal of the application is to give a user advise on a subject called X.
In order to give the user information about subject X, the application needs a lot of userdata. The input of the data is handled across multiple pages due to the enormous amount of information needed.
For example:
Screen 1: The user fills in personal information.
Screen 2: The user fills in information about his car.
Screen 3: The user fills in information about his favorite color.
Screen 4: The user fills in information about his dog.
Screen 5: Advise! Get yourself another dog, because as long as your name is * and you drive a * in the color *, he'll never ride with you.
Clearly, in this situation, we have a straight and forward navigation path.
We want information about a subject and then move on to the next screen.
Problem is, I can't figure out where to position this next button in an App. I've struggled with this navigation problem for so long I wonder if I've got the whole "mobile navigation" part wrong. How are App with such goals usually transformed into an App?
For a long time I had a hacky solution, but since I started using Xamarin.Forms and couldn't find a default way of getting from one screen to another I started to wonder about the problem at a more abstract level.
in Xamarin.Forms, you'd solve your navigation problem using a NavigationPage. When the current page is complete, or on a button click, you'll just do navigationPage.PushAsync (nextPage);. The Back path is provided by the platform.
Your question has no answer, it's most than technology, it's about UX
For me, the best way to control your navigations with business rules is using Prism framework.
With this you can navigate by ViewModel.
I have an app that show a list of images. The image source is set to a http URL, and the images are downloaded and display automatically.
However, while the app is taking time to download, the image control shows nothing. The user experience is not good this way.
How may I display a loading placeholder image, or a loading gauge, for each of the image control?
While an image is loading, it is drawn transparently. You can use this to your advantage to display an element underneath the image while it is loading. For example, you could have a stock image that is bundled with your XAP that represents a default avatar for example. Or you could display a XAML loading animation. Then when the image is finished loading, it will obscure the element behind it.
Mick's suggestion is a good one if you need to minimize your visual tree and if your scenario allows for a code solution. This suggestion is not perfect but it does make it easier to deal with the case where your placeholder image is unscaled/centered but the loaded image is scaled/stretched.
You could set the image source to your placeholder then when ImageOpened fires, change it to the remote url and let that run it's course.
In addition to the 2 other suggestions (from Josh & Mick) you could display a placeholder in the xaml and then, in code, download the actual desired image in the background using HttpWebRequest. Then when the image has fully downloaded save it to isolated storage and then update the source to the displayed image.
Yes this is more complex than the other solutions but would simplify the visual tree and avoid a blank image being displayed while the image is downloaded.
It would also give you offline caching of images too.
Interesting how many options there are for tackling this problem.
You might also like to consider Ben Gracewood's image caching implementation or what appears to be a development on that idea in his blog comments.
One-time Cached Images in Windows Phone 7 « Ben.geek.nz
Peter Nowaks Mobile Blog - “Intelligent” Image Caching for WP 7
Some background on the discussion leading up to this here if it's of interest.
Image control cache duration?
I've searched around for a while today, but I haven't been able to come up with an AutoComplete TextBox code sample for Silverlight 2 Beta 2. The most promising reference was found on nikhilk.net but the online demo doesn't currently render and after downloading a getting the code to compile with Beta 2, I couldn't get the Silverlight plugin it to render either. I think it is fair to say it is a compatibility issue, but I'm not sure. Does anyone have any alternate sample code or implementation suggestions?
You may want to take a look at my blog: http://weblogs.manas.com.ar/ary/2008/09/26/autocomplete-in-silverlight/
You simply write in your XAML:
manas:Autocomplete.Suggest="DoSuggest"
and then in the class file, you need to implement that method, which report suggestions to a delegate. The options can be hardcoded, requested to a web service, or whaterver.
Take a look at the combobox(very close to a autocomplete text box) at worksight's blog Silverlight ComboBox
There is also another good example here:
http://silvermail.com.au
This is a Silverlight based mail client that looks a little like Outlook. When I go to send mail and start typing in the "To" text box, an auto-complete pops up and populates the control for me based on values in a list... I think it automatically stores the addresses in isolated storage, but that's just a guess.
This is a really handy tool for checking mail while away from my home PC... at work for example... and it is loaded with impressive Silverlight functionality.
S.