Worklight user-agent - ibm-mobilefirst

I've been showing a page on the console (Android environment), and testing if this external page (an html page of mine) has been opened using a mobile device or a desktop by checking the user-agent using this piece of code:
navigator.userAgent.match(/Android/i)
If I run this piece of code on the real device it shows it's an Android device, if I launch the Worklight Console it shows it's a desktop device. How can I change the user-agent in order to let Console think it's an Android device? I've installed the Chrome extension but I didn't understand how to use it.

It sounds to me like you want to debug your Android environment (which is meant for mobile devices) while using the Chrome desktop browser?
Try the following and see if this is what you want:
Preview the web resources
If all your web resources are in the common\css or common\js folder, open Worklight Console and click on "preview web resources"
If the web resources are coming from both the common\ and android\ folders, you can use this URL structure: http://replace-with-host-or-ip-address:10080/replace-with-project-name/apps/services/preview/replace-with-app-name/android/1.0,
Open the Chrome DevTools and click on the device icon:
Then, from the UI that will open up you can select from the Devices dropdown to adjust the viewport to that of the chosen Android device.

Related

Mobile used web app automation without Appium?

Can we use normal selenium web automation to test a mobile web app by changing window size to mobile resolution? or do we need to use an emulator and appium?
Currently, I'm working in a company. I didn't use appium for mobile web app automation. What I did is an automated web app with selenium ,Robot Framework as a normal web application and changed the window size to mobile resolution. Is it right?
sample code for window size set for mobile size is shown below for more understanding...!
open browser https://sample.com chrome
set window size 440 717
Thanks for your help guys!!
I would suggest you to use Appium if it's a mobile-based web application as this is the preferred way of end-to-end testing.
For mobile automation, you don't need to download Android Studio as it is an heavy-weight tool. You can make use of avdmanager.
To create emulators, you can refer https://gist.github.com/mrk-han/66ac1a724456cadf1c93f4218c6060ae
Hi guys, I found a clarification for this according to my question.I'm trying to automate a WebApp for mobile and I'm testing in a mobile chrome browser. So it is easy to find elements with appium.We will not need appium inspector to capture elements as we are automating a mobile web application.Not a Native Android app.
https://appiumpro.com/editions/57-how-to-determine-element-locators-for-mobile-web-and-hybrid-apps
Refer above link and inspect the elements. It's totally the same as we are doing normal web automation. The only difference is using the emulator and appium server to run the test.
It was a kind of major issue for me as a beginner.I think now it's been solved.

Configuring Worklight Application Center download/install

I have the Worklight 6.1 Application Center installed on a server.
Users install from the the Application Center by visiting a url on their mobile browser. Clicking the Install button downloads the mobile app. But when the mobile user taps the Install button, the mobile browser window does not close, so the user gets no feedback that the download is occurring.
How can the behavior of the Install button be configured to make sure the browser window closes when the install begins?
The answer depends on the mobile operating system you are using when visiting the installers.html URL and clicking on the Install button.
In:
Android: a "Downloading..." toast message is displayed
iOS 7: the mobile Safari app goes to the background and you can see the application being installed
iOS 8: the mobile Safari app will not go to the background
In iOS, Apple does not expose any APIs to the developer in order to provide visual cues as an application is being downloaded.

Cannot view video from publisher using Chrome to iPad with OpenTok

I'm currently trying to set up a connection between my web client and my iOS app, but for some reason my iOS client only sees a black box when using Chrome (version 33). I can see the video just fine if I use Firefox (both in my app and when I put the browsers side-by-side, they can see each other).
This doesn't appear to be a documented known issue with the JavaScript SDK, and I can't see any recent discussion about this on the forums (last post was mine).
The iOS sample can be located here (samples/OpenTokHelloWorld) with the browser page in samples/OpenTokHelloWorld/browser_demo.html
I suggest cd'ing into samples/OpenTokHelloWorld and running python -m SimpleHTTPServer, as it can't be run from a file:/// path.
Here is what my iPad sees:
Chrome:
Firefox:
And Chrome/Firefox (respectively), both publishing video from the same camera
Edit: after testing on other machines, it may be something specific to my environment even though none of my extensions run in Incognito and I don't have any custom plugins installed.
It looks like the OpenTok mobile SDKs with the specific webcam I was using has issues. On Android the video stream will display for a brief moment then segfault, and on iOS there will be no video at all.
I have tested this many times and could not reproduce what you are seeing in your chrome.
Without seeing any console errors or iOS logs the best suggestion is to try clearing your cache, or maybe restarting your computer (longshot)

IBM Worklight 6.0 - Unable to enable the Cordova geolocation control in the Mobile Browser Simulator

running WL Studio 6.0, on RHEL 6, with Firefox.
I am unable to enable the Cordova geolocation control in the Mobile Browser Simulator. When I expand the Geolocation section in Cordova controls, all I get is the following message within the control:
"Using the geolocation service provided with Firefox."
I have turned off Firefox's "geo.enabled" config setting in about:config, reloaded the page, restarted the browser.
I have set Firefox's Share Location permission to blocked in my page settings for the MBS page and reloaded the browser.
Is there a way to enable this MBS feature on firefox (on linux)?
There is no setting in the Mobile Browser Simulator to change that, but sounds like there should be. Or at least needs to better detect if the FireFox geo.enabled setting is turned on.

How to upload a photo image using Sencha Touch without phonegap

Is it possible to upload an image created by the phone using Sencha Touch but without any dependency on PhoneGap? Basically my app will be accessible via the web, and not installed natively on the device. I want to be able to select an image from the phone storage and then be able to upload it to the service. I effectively want the same functionality as you would get with the file upload control on a normal desktop browser.
Is this possible, and if so how?
There is a current solution in its infancy, but it works. I tested it on my Nexus 7 using Chrome. Here is the list of compatibility:
Android (4.0 up) browser support as regular
Google Chrome for desktop and mobile
iOS Safari browser support from version 6.0 (not tested on mobile)
https://github.com/kostysh/File-uploading-component-for-Sencha-Touch
Desktop webbrowser and mobile browser are different in lot many cases. To access file upload option you need to access the OS API which is not possible using javascript only. Phonegap provides us option to connect js with device API. If you can find a way to do this, without using Phonegap, then may be you can fix, or else its not possible.