I'm using robot framework with playwright (browser) on Windows.
I'm trying to allow the usage of the web cam, that message appears on a popup window, like this:
Anyone can help me to handle this kind of popups?
Thanks
Joao
You should be easily able to give access to camera using browser-context-grant-permissions api.
You just need to update playwright.config.ts file where you set up browser under different project.
{
name: 'chromium',
use:{
permissions: ["camera"]
}
}
You can also provide the permission of microphone together like below
{
name: 'chromium',
use:{
permissions: ["microphone","camera"]
}
}
Related
I have an app maker application using the Google Drive File picker widget. But uploading files does not work, I get a server rejected error.
API Upload Response
{
"errorMessage": {
"reason": "REQUEST_REJECTED",
"additionalInfo": {
"uploader_service.GoogleRupioAdditionalInfo": {
"completionInfo": {
"status": "REJECTED"
},
"requestRejectedInfo": {
"reasonDescription": "agent_rejected"
}
}
},
"upload_id": "UrqXRaPdnG_DZ0L-iDX5BJsG4XEg"
}
I believe the issue is the app's oauth scopes. It appears to only have read access which is insufficient for uploading new files.
I'd like to grant it full access https://www.googleapis.com/auth/drive but I'm not clear how to do this.
This behavior is a bug and it has been recently introduced as far as I'm aware. To be honest, the full drive scope should be granted when enabling the simple uploads feature in the drive picker but some reason it is not doing it. As a work around, you can put the following in any server script:
/***
Dummy function for drive full permissions
****/
function dummyForDrivePermission(){
var file = DriveApp.addFile();
}
The above code, will force appmaker to recognize that it needs to upload files, although you will never invoke the function but it will server the purpose of granting the scope you need.
I am using react-native-google-analytics-bridge in my react native application. I want to create a google analytics session when user logs in and close it when user logs out. I could not find any related information in the react-native-google-analytics-bridge documentation. (https://github.com/idehub/react-native-google-analytics-bridge)
Any help is appreciated.
Solved it for android
At this moment react-native-google-analytics-bridge has no sessionControl api. To add that Find below files inside react-native-google-analytics-bridge folder
GoogleAnalyticsBridge.java and add
#ReactMethod
public void createNewSession(String trackerId, String screenName) {
Tracker tracker = getTracker(trackerId);
tracker.setScreenName(screenName);
tracker.send(new HitBuilders.ScreenViewBuilder().setNewSession().build());
}
GoogleAnalyticsTracker.js and add
createNewSession(screenName) {
GoogleAnalyticsBridge.createNewSession(this.id, screenName);
}
GoogleAnalyticsBackwardsCompatibility.js and add
createNewSession(screenName) {
this.tracker.createNewSession(screenName);
}
RCTGoogleAnalyticsBridge.m (adding only the signature for ios) and add
RCT_EXPORT_METHOD(createNewSession:(NSString *)trackerId screenName:(NSString *)screenName)
{
}
go inside react-native-google-analytics-bridge/android folder and clean by using "./gradlew clean command"
then from react-native-google-analytics-bridge folder build with the changes made using "npm run start"
I am creating a firefox OS application, I want the user to be able to share a link through any application installed and eligible (facebook, twitter etc). I saw android has this kind of feature and firefox OS has it as well, as I saw it in one of it's built in applications. Went through Web API, didn't find a suitable match,
Any ideas how to do it?
This is the intended use of the Web Activity API . The idea is that applications register to handle activities like share. The Firefox OS Boiler Plate app has several examples of using Web Activities. In that example a user could share a url using code like:
var share = document.querySelector("#share");
if (share) {
share.onclick = function () {
new MozActivity({
name: "share",
data: {
number: 1,
url: "http://robertnyman.com"
}
});
};
}
Any app that handles the share activity will be shown allowing the user to pick the proper app to handle the share.
How can you detect the url that I am browsing in chrome/safari/firefox via cocoa (desktop app)?
As a side but related note, are there any security restrictions when developing a desktop app that the user will be alerted and asked if they want to allow? e.g. if the app accesses their contact information etc.
Looking for a cocoa based solution, not javascript.
I would do this as an extension, and because you would like to target Chrome, Safari, and Firefox, I'd use a cross-browser extension framework like Crossrider.
So go to crossrider.com, set up an account and create a new extension. Then open the background.js file and paste in code like this:
appAPI.ready(function($) {
appAPI.message.addListener({channel: "notifyPageUrl"}, function(msg) {
//Do something, like send an xhr post somewhere
// notifying you of the pageUrl that the user visited.
// The url is contained within msg.pageUrl
});
var opts = { listen: true};
// Note: When defining the callback function, the first parameter is an object that
// contains the page URL, and the second parameter contains the data passed
// to the context of the callback function.
appAPI.webRequest.onBeforeNavigate.addListener(function(details, opaqueData) {
// Where:
// * details.pageUrl is the URL of the tab requesting the page
// * opaqueData is the data passed to the context of the callback function
if(opaqueData.listen){
appAPI.message.toBackground({
msg: details.pageUrl
}, {channel: "notifyPageUrl"});
}
}, opts ); // opts is the opaque parameter that is passed to the callback function
});
Then install the extension! In the example above, nothing is being done with the detected pageUrl that the user is visiting, but you can do whatever you like here - you could send a message to the user, you could restrict access utilizing the cancel or redirectTo return parameters, you could log it locally utilizing the crossrider appAPI.db API or you could send the notification elsewhere, cross-domain, to wherever you like utilizing an XHR request from the background directly.
Hope that helps!
And to answer the question on security issues desktop-side, just note that desktop applications will have the permissions of the user under which they run. So if you are thinking of providing a desktop app that your users will run locally, say something that will detect urls they access by tapping into the network stream using something like winpcap on windows or libpcap on *nix varieties, then just be aware of that - and also that libpcap and friends would have to have access to a network card that can be placed in promiscuous mode in the first place, by the user in question.
the pcap / installed desktop app solutions are pretty invasive - most folks don't want you listening in on literally everything and may actually violate some security policies depending on where your users work - their network administrators may not appreciate you "sniffing", whether that is the actual purpose or not. Security guys can get real spooky so-to-speak on these kinds of topics.
The extension via Crossrider is probably the easiest and least intrusive way of accomplishing your goal if I understand the goal correctly.
One last note, you can get the current tab urls for all tabs using Crossrider's tabs API:
// retrieves the array of tabs
appAPI.tabs.getAllTabs(function(allTabInfo) {
// Display the array
for (var i=0; i<allTabInfo.length; i++) {
console.log(
'tabId: ' + allTabInfo[i].tabId +
' tabUrl: ' + allTabInfo[i].tabUrl
);
}
});
For the tab API, refer to:
http://docs.crossrider.com/#!/api/appAPI.tabs
For the background navigation API:
http://docs.crossrider.com/#!/api/appAPI.webRequest.onBeforeNavigate
And for the messaging:
http://docs.crossrider.com/#!/api/appAPI.message
And for the appAPI.db stuff:
http://docs.crossrider.com/#!/api/appAPI.db
Have you looked into the Scripting Bridge? You could have an app that launches, say, an Applescript which verifies if any of the well known browser is opened and ask them which documents (URL) they are viewing.
Note: It doesn't necessarily need to be an applescript; you can access the Scripting Bridge through cocoa.
It would, however, require the browser to support it. I know Safari supports it but ignore if the others do.
Just as a quick note:
There are ways to do it via AppleScript, and you can easily wrap this code into NSAppleScript calls.
Here's gist with AppleScript commands for Safari and Chrome. Firefox seems to not support AE.
Well obviously this is what I had come across on google.
chrome.tabs.
getSelected
(null,
function
(tab) {
alert
(tab.url);
}) ;
in pure javascript we can use
alert(document.URL);
alert(window.location.href)
function to get current url
I've set a ondrop event on my drop area and it receives an event when I drag an image from my desktop to the drop area.
However, according to the Recommended_Drag_Types document:
https://developer.mozilla.org/en/DragDrop/Recommended_Drag_Types
A local file is dragged using the application/x-moz-file type with a data value that is an nsIFile object. Non-privileged web pages are not able to retrieve or modify data of this type.
That makes sense, but how do I prompt the user to escalate privileges to get access to the file data and send it via an XMLHttpRequest?
If I try it without escalating privileges when I do this code:
event.dataTransfer.mozSetDataAt("application/x-moz-file", file, 0);
Javascript returns this error:
Permission denied for domain.com to create wrapper for object of class UnnamedClass
The only article I can find on this is one from 2005 but I can't tell if the directions still apply to Firefox 3, it suggest doing this:
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
which doesn't seem to work.
If you haven't upgraded to 3.5 yet, you can use the dragdropupload extension.
I found out that if instead of escalating privileges globally:
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
...
function doDrop(event) {
...
var file = event.dataTransfer.mozGetDataAt("application/x-moz-file", 0);
...
}
I escalate privileges in the function's body:
...
function doDrop(event) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
...
var file = event.dataTransfer.mozGetDataAt("application/x-moz-file", 0);
...
}
I get rid of the error you described and gain access to the nsIFile instance I was looking for.