Taking screenshots with Selenium Builder - selenium

Using Selenium Builder, I've created the following json file:
{
"type": "script",
"seleniumVersion": "2",
"formatVersion": 2,
"steps": [
{
"type": "get",
"url": "http://stackoverflow.com/"
},
{
"type": "saveScreenshot",
"file": foo.png"
}
],
"data": {
"configs": {},
"source": "none"
},
"inputs": [],
"timeoutSeconds": 60
}
I tried running it on Windows 7 and two different Ubuntu machines. Instead of the filepath "foo.png" I had also inserted "E:\foo.png" / "/home/swege/foo.png". However, I always get the "exception":
Could not take screenshot of current page - [object Object]
At least I would like to be able to read the "error object", but every system just puts out that the error is a JavaScript object. Any idea how to fix the issue or read the full error message?

Try following :
http://www.ontestautomation.com/how-to-create-screenshots-in-your-selenium-webdriver-tests/
Above can help you to get exact code that how you can take screenshots using selenium.

So I pulled down and looked at the source for Selenium Builder 2 and found two files that I think show the origin of the error, command_processor.js and driver_component.js.
I can't make out why the error is occurring - maybe someone here can build on this?

Try using a full file path, not just foo.png. On Mac, these worked for me: ~/foo.png and ~/Downloads/screenshots/foo.png.
It's also important that the folder exists and is writable by the account running the web browser.

Related

Selenium IDE doesn't do anything for "pause" command

I'm using the selenium IDE for Chrome on Mac Big Sur. I want to add a puse in between commands to see why something isn't executing properly. This is in my ".side" file
}, {
"id": "32f35ed7-1a28-4540-a93d-3cb8ba0e012a",
"comment": "",
"command": "pause",
"target": "",
"targets": [],
"value": "100000"
}, {
I have put a really high value but when I play back my test, it just breezes through it without pausing at all, although it tells me the command was successfully run
What's the right way to pause my test?
Use Target instead of Value, Like below
Target: 100000
instead of
value: 100000
Also,
Set speed to fastest (Actions --> Fastest), otherwise it won't work.

IOS Universal links using expo is NOT working

I've an EXPO app and i'm trying to get into the app from external links (universal/deep linking), Android is up and running perfectly and IOS is not working.
the app.json file is configured as described here:
"associatedDomains": [
"applinks:*.<DOMAIN_NAME>.com",
"applinks:<SUB_DOMAIN>.<DOMAIN_NAME>.com"
]
And because of my app is using WEBVIEW of my original website, the file /.well-known/apple-app-site-association is located at my client repository under the SRC folder like so:
Content-Type: application/pkcs7-mime
{
"applinks": {
"apps": [],
"details": [{
"appID": "<APP_ID>",
"paths": ["/login/*"]
}]
}
}
Now, AASA validator is OK, but external links still not opening the native app!!!
What to do?!
I found the answer on the expo forums and want to post the solution here because I spent hours/days trying to figure out the answer. And kept running into this question here on SO. And due to only being easily testable on production(vs local or release channel deployments). I want to save other users the pain of releasing their app with broken universal deep links.
Expo's documentation isn't clear here. In the iOS section of Expo's linking guide is fairly vague and some of the language is not explicit or clear enough. To make matters worse everything you find on SO or elsewhere is filled with conflicting and out of date info.
While the OP's question is likely solved solely by the last item in this list, I want to cover a couple of things I also had issues figuring this out for posterity and to clear things up I kept trying to piece together:
appID is basically a combination of the iOS team ID which can be found in the apple developer console under membership. And the bundle id found in app store connect > app > app information (or it should also be in your app.json).
Some of apple's documentation can be confusing and wildcards do match more than one character. So for example a path of "/auth/*" will properly route the a url with the path of "/auth/login".
You do not need to sign your AASA file.
Do not include https or paths in your associatedDomains configured in app.json it should just be the domain (e.g. "applinks:google.com").
The working mime type for your AASA is application/pkcs7-mime and not application/json
you're AASA file can me in your root directory or .well-known [docs], I suggest placing it on both as this will help create some redundancy. You can upload one file and configure your server to resolve the same file.
You need to enable associated domains service for you identifier. Expo states this in their documentation but the navigation to where to do this is out of date. On the developer portal > Certificates, Identifiers & Profiles > identifiers > click on the identifier that maches your app's bundle ID > capabilities > Check "Associated Domains" It will tell you that this will invalidate your signing profile and you'll need a new one to deploy your app. So long as you are in a managed expo app, expo will handle this for you when you create a new build.
The main problem you're facing is that the AASA file or apple-app-site-association has gone through 3 different iterations with different schemas. Each schema is fairly different and you need to combine all 3 schemas to support all current + older versions of iOS. The schema in the OPs question is used by ios 11 & 12 and not supported by iOS 13+ (which came out 2019). Expo's documentation is unclear about this and makes it sound like the displayed version will work with all versions and you can use the new schema if you want the added features, however the new schema is absolutely necessary to work with newer iphones. The expo documentation has the new schema minified so you don't even realize it exists if you're not paying attention.
Another user explained this solution in depth on the expo forums - I won't go into as much depth but will include his combinations of the different schemas that did work for me so that it's easier to find. (although the new schema is probably sufficient if you don't plan on supporting anything lower than iOS 13. as 15 is the current version as of this writing)
Example of all the schemas combined.
{
"applinks": {
"apps": [],
"details": [
{
"appIDs": [ "TEAMID.bundleidentifier", "ABCDE12345.com.example.app2" ],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
},
{
"/": "/buy/*",
"comment": "Matches any URL whose path starts with /buy/"
},
{
"/": "/help/website/*",
"exclude": true,
"comment": "Matches any URL whose path starts with /help/website/ and instructs the system not to open it as a universal link"
},
{
"/": "/help/*",
"?": { "articleNumber": "????" },
"comment": "Matches any URL whose path starts with /help/ and which has a query item with name 'articleNumber' and a value of exactly 4 characters"
}
]
},
{
"appID": "TEAMID.bundleidentifier",
"paths": [ "/buy/*", "/help/website/*", "/help/*" ]
},
{
"appID": "OTHTEAMID.otherbundleidentifier",
"paths": [ "/blog", "/blog/post/*" ]
},
{
"appID": "YAOTHTEAMID.yetanotherbundleidentifier",
"paths": [ "*" ]
}
]
},
"activitycontinuation": {
"apps": [
"TEAMID.bundleidentifier",
"OTHTEAMID.otherbundleidentifier"
]
}
Example of the new schema if you don't need to support older versions of iOS
{
"applinks": {
"apps": [],
"details": [
{
"appIDs": ["ABCDE12345.com.example.app", "ABCDE12345.com.example.app2"],
"components": [
{
"#": "no_universal_links",
"exclude": true,
"comment": "Matches any URL whose fragment equals no_universal_links and instructs the system not to open it as a universal link"
},
{
"/": "/buy/*",
"comment": "Matches any URL whose path starts with /buy/"
},
{
"/": "/help/website/*",
"exclude": true,
"comment": "Matches any URL whose path starts with /help/website/ and instructs the system not to open it as a universal link"
},
{
"/": "/help/*",
"?": { "articleNumber": "????" },
"comment": "Matches any URL whose path starts with /help/ and which has a query item with name 'articleNumber' and a value of exactly 4 characters"
}
]
}
]
}

Unable to connect to a site from Testcafe IDE on OSX

My fixtures are set up like so
{
"fixtures": [
{
"name": "login",
"pageUrl": "http:\/\/localhost:3000\/",
"tests": [
{
"name": "type name",
"commands": [
{
"type": "type-text",
"studio": {
},
"callsite": "0",
"selector": {
"type": "js-expr",
"value": "input[type=email]"
},
"options": {
},
"text": "example#email.com"
}
]
}
]
}
]
}
with one simple test to find the input and type some text but when running the command I get
testcafe chrome login.testcafe
ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
Type "testcafe -h" for help.
I've seen this issue a couple of times on their issues board one relating to CI integration on a Linux server and another which seems like a similar issue of trying to connect to localhost
https://github.com/DevExpress/testcafe-browser-provider-electron/issues/20
https://github.com/DevExpress/testcafe/issues/1133
New to testcafe any help would be appreciated!
I've found the solution some network policies don't allow access to your machine on some ports in my example it's 57501.
testcafe chrome login.testcafe --hostname localhost
adding --hostname resolves the issue
documentation
https://devexpress.github.io/testcafe/documentation/using-testcafe/command-line-interface.html#--hostname-name
I still don't know how to launch from the IDE but this resolves my main issue.
TestCafe Studio Preview does not support setting command line options (hostname in your case). The TestCafe team is going to implement this functionality in the official release.
So, for now, it is only possible to run tests via a command line.
UPDATE:
You can set the hostname option in the TestCafe Studio Settings dialog:

Windows image fails to pull with error "failed to register layer"

I have image stored in AzureCI and I it fails to launch with following errors. I would assume since second entry is backing off of pulling image that image actually successfully downloaded but there is no additional information available about second error. Image is based of microsoft/dotnet-framework which is in turn based off windowsservercore image
{
"count": 58,
"firstTimestamp": "2018-01-23T04:06:59+00:00",
"lastTimestamp": "2018-01-23T12:37:39+00:00",
"message": "pulling image \"cr.azurecr.io/id-poc:latest\"",
"name": "Pulling",
"type": "Normal"
},
{
"count": 331,
"firstTimestamp": "2018-01-23T04:07:15+00:00",
"lastTimestamp": "2018-01-23T12:29:53+00:00",
"message": "Back-off pulling image \"cr.azurecr.io/id-poc:latest\"",
"name": "BackOff",
"type": "Normal"
},
{
"count": 1,
"firstTimestamp": "2018-01-23T11:52:33+00:00",
"lastTimestamp": "2018-01-23T11:52:33+00:00",
"message": "Failed to pull image \"cr.azurecr.io/id-poc:latest\": failed to register layer: re-exec error: exit status 1: output: failed in Win32: The system cannot find the file specified. (0x2) \nhcsshim::ImportLayer failed in Win32: The system cannot find the file specified. (0x2)",
"name": "Failed",
"type": "Warning"
}, this continues 10 more times
Edit 2: Turns out it was due to a base of unsupported Windows 1709.
Edit: Thanks for the clarification, made an assumption it was 1709 there. Let me look into it!
Unfortunately Windows 1709 images are not supported right now on Azure Container Instances. This will be fixed in the April time frame. In the mean time please use Windows images based on other versions as a work around - apologies for that! We're working on it!

PushNotification -- no device found

I have a hybrid app and having some issue seeing notification..
I get the error
com.ibm.pushworks.server.exceptions.PushWorksException: FPWSE0009E: Internal server error. No devices found
I running on Local MFP (eclipse -- V7.1).. I see the device in the worklightconsole and the app is install on my phone (Xcode->phone via USB) and I see the opt-in notification message.. However, I get the error when I tried to send a push..
I am using postman and the restAPI
http://localhost:10080/worklightadmin/management-apis/1.0/runtimes/MyMobile/notifications/applications/myProj/messages
Here is the body of the post request
{
"message": {
"alert": "Test message"
},
"settings": {
"apns": {
"badge": 1,
"iosActionKey": "Ok",
"payload": {},
"sound": "song.mp3"
},
"gcm": {
"payload": {},
"sound": "song.mp3"
}
},
"target": {
"consumerIds": [],
"deviceIds": ["166CB698-45C2-4C61-9074-248EA4F8AA8F"],
"platforms": [
"A","G"
]
}
}
Can you give some hints to solve this issue ..
Thanks
As Vivin mentioned in the comments, your device ID may be wrong.
The same JSON works for me , in my local setup. Is it possible the device id you entered is wrong? With the current parameters within "target" you can get the error message only if the device id is wrong.