I am making a WebRTC application and the allow permission to use camera pops up. I know there is no way to remove that but is there a way to automate the clicking of the allow button using selenium on the client's side? because the 90% of the clients are not clicking the allow button, even though we put an instruction to click the allow button and that it is safe to click it but still they are not clicking it and some clicked deny.
Currently my only solution is by letting the client download a c# application and all it does is restart the browser with --use-fake-ui-for-media-stream, but I think its not a good idea. So if there is a way to automate the clicking of allow button please tell me. Thanks guys, your help is greatly appreciated.
You can try out http://testrtc.com/
They use Selenium internally, with a focus on testing WebRTC services. They make sure the allow button gets pressed (=overridden) and replace the camera and microphone with virtual devices and media files of your choosing.
Related
I want to write an application in C# that only opens when the user starts to drag a file in the Windows Explorer. It doesn't matter if the file will be dropped in the app, i only want to know whenever the user drags a file in explorer, and of course, when he releases it again.
I found this article, but I don't really know where to start: Detect drag and drop operations in an external application using .Net
Since I know hardly anything about hooking, I would really appreciate it if someone could give me an example of doing that, or some ideas.
I'm trying to log into a website and use Selenium to take a screenshot through code. So far, it's been working great except for one problem: every time I access the website, both manually and with Selenium, a popup asks me to confirm a security certificate.
The certificate is good, but I cannot for the life of me get Selenium to accept the window. I know it can deal with Alerts and accept them thusly:
driver.Navigate().GoToUrl("https://www.securewebsite.com");
driver.SwitchTo().Alert().Accept();
but the box doesn't disappear or react, and attempting to do anything with the driver besides accepting or declining the alert (with no effect) results in a Modal Dialog Present error.
I'm looking for either a way to turn off this popup or a way for Selenium to deal with it in code, preferably the latter. Let me know if I can provide any more information.
Alright, I couldn't figure it out, so I just disabled the popup. It's poor practice and binding the application to the specific instance of IE, but it was all I could come up with.
I would like to build a bot - web crawler - to collect phone numbers.
I have a problem though: to see the phone number, a user must click something like "Show".
How can I solve this problem?
Check what the act of clicking on the button does. Does it call a Javascript function? Does that make an HTTP call to a backend? If so your bot should do that call instead of screen-scraping the first page. If not, does it just play with the DOM of the page to show an item on screen?
All the data you're looking for comes from some sort of back-end, so if you look in the developer tools of your browser when going through the page you can usually figure out what calls to script in order to get the data.
It is possible to make this harder (and that is what some sites to to protect themselves from scraping). Typically if you're in this situation, what you're doing is not entirely legal or nice. But technically it's very interesting, so here goes.
The best way to go forward is to run the site in a real browser (like PhantomJS, or Chrome) and use a framework like Webdriver to simulate browser interactions. This way you can pull most of the data out usually.
If you find that your ip gets blocked, you may use Tor and use multiple instances dynamically to hit the site... but make sure you ask the site owner nicely if you're allowed to do that of course.
I've been writing an ActiveX plugin for IE using .NET. While I've happily got it to deploy, install and what not, I'm finding that IE isn't passing keyboard events to it.
Is there a way to get IE to pass along keyboard events to it?
This problem has been seen to happen on IE7 and IE8, haven't tested other versions of IE though, mainly because I'm using IE8 and the customer will be using IE7.
Thanks in advance.
Edit:
In this case the particular keys I'm interested in are the delete key and the end key
This is a problem with how the browser loads and exposes the object.
As a security measure, some objects will not be activated, until clicked on, and then receive keyboard input.
I actually found a solution Using JavaScript, to pass the characters to the ActiveX Object, so that you do not have to click on it first, to activate it.
I used it for a bar code scanning solution, as there was no keyboard or mouse attached to the device.
Silver light out of browser mode, made the keyboard input available straight away, and became a better solution. Not sure if the latest version still allows it.
I have developed an application(downloader) using C# now i want to integrate it to browser like i want to place a button in browsers if user press that button then my app should execute & start downloading the required file.
I'm largely guessing, but it sounds like you are talking about a "protocol handler", i.e. to handle hyperlinks to "yourapp:some-stuff-here". If so, try looking at Registering an Application to a URL Protocol on MSDN, which gives a C# example of this.
I don't think that what you want is possible, you can however place a link to the executable and tell your users to execute it via the Browser download options (The Dialog that pops up when you click on some download link that asks wether you want to open oder save the file).
It is not possible to immedatly run your GUI application on a browser button click.