How to work with video in selenium-webdriver? - selenium

I have some videos and I want to test their with automation.
Could you tell, how does selenium-webdriver work with video?
How does it recognize it?

Selenium can test if the correct elements are in the DOM for video. You won't really be able to interact with the video with Selenium. You many need to record the network traffic to check the relevant items are being downloaded or if they 404.

I use WebdriverJS to click on youtube video.
I have tested the methods below and found them to work.
.click("#videoid")
.click("iframe:hover")
.click(".classname")
This of course is a little surprising as Selenium is not supposed to work with flash...

Related

Firefox - hide browser frame with Selenium

I'm trying to figure out how to hide the border (including the address bar, tabs, title bar... everything that isn't the browser viewport) of my Firefox instance instantiated by Selenium.
If there's some way to have it use a userChrome.css, that would be straightforward enough. I've tried loading a profile folder that included a userChrome.css using this answer as a guide, but it seemed to ignore the styles. I've also looked through Firefox's about:config to see if there's some preference that would hide the frame of the window, but I haven't found anything yet.
Any solution that allows me to hide all or some of these elements when creating the instance with Selenium would be helpful. I know it's silly, but that's how it goes sometimes, you know?
-edit-
I don't think the title bar needs to be hidden. But everything else should be hidden.
-another edit to clarify a few things-
I mentioned kiosk mode in the comments as an example of the sort of thing I'm going for. Kiosk mode isn't exactly what I'm looking for, though. The windows aren't meant to be fullscreen, but they should still lack the elements of a common browser window. Think of it as like an Electron app. Out of the box, Electron lacks an address bar, tabs, etc. That's basically what we have for our app, but it's with regular-old Firefox. Again, whether these elements are displayed or not doesn't typically impact the test, but we want them hidden anyway.
Finally, I a friend of mine tried achieving this goal using a userChrome.css wrapped in a Firefox profile and was able to get Selenium to use the userChrome. So perhaps I need to figure out what I'm doing wrong. The biggest difference between how he did it and how I'm doing it is I must use a remote web driver for testing. But even still, it should be able to load the userChrome.css file. I'll try to update this question with more details as I fiddle with it some more.
-edit-
I think the reason userChrome isn't working when specifying a profile is because of the version(s) of Selenium/Geckodriver/Firefox being used.
The geckodriver version I started with was 0.15. 0.17 behaved exactly the same. 0.18 didn't respect the profile I passed along to it at all and instead had Firefox open the profile selection window (not very useful, but I was able to at least select the correct profile and see the userChrome.css get applied). 0.24 is no different.
Firefox is 52.9.0. Not much I can do about that.
We're using selenium (standalone) server 3.8.1. Switching out for 3.141.59 Didn't change anything.
Unless there's a version combination that will work with Firefox 52, I think the only thing I can do is wait until there's an update.
At last I have figured it out. In order to get Selenium to use my custom profile, I needed to do the following:
FirefoxProfile profile = new FirefoxProfile(new File(path_to_profile));
FirefoxOptions options = new FirefoxOptions().setProfile(profile);
RemoteWebDriver driver = new RemoteWebDriver(options.toCapabilities());
driver.get(url_of_webpage);
Thanks to avinesh09 on Github for the info I needed to solve the problem. It's so simple, but this has to be the only way that I neglected to try to load the profile.
If fullscreen (kiosk) mode is what you ask for (as then all you see is the viewport) it is as simple as:
driver.manage().window().fullscreen();
It is the same user experience as pressing "F11" in your browser.

Can i get screenshot of desktop using vuejs

i am working on tracking app using vue.js. I am a new developer.i wanna know is it possible to track mouse click and capture screenshots even if person is on desktop or any where else on browser
This has nothing to do with VueJs specifically. However, you can use HTML5/Canvas/Javascript to take a screenshot, but that's still experimental.
Take a look at this answer: Using HTML5/Canvas/JavaScript to take in-browser screenshots
i have found the solution
i followed the steps here
https://www.webrtc-experiment.com/getScreenId/
these steps allowed me the screen sharing on my webpage and then i use html to canvas to get the image of the video tag

simulating file download with selenium on chrome browser for element with reactid

I need to simulate file download on chrome browser and below links points to solutions which is what I'm looking for.
http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/
https://github.com/Ardesco/Ebselen/blob/master/ebselen-core/src/main/java/com/lazerycode/ebselen/customhandlers/FileDownloader.java
I'm not able to use this code as it requires attribute and in my case button has a reactid which triggers a end point call. Please refer to attached screen shot.
Can somebody please tell what changes I need to do to make code in above links work ?
Thanks in advance.
Regards,
Vikram
To be able to download a link to need to find a way to get the link. The best way to do that is to talk to the developer that wrote the code and find out how it works.
Clicking on the button will trigger some sort of JavaScript event, you need to know what that event is so that you can replicate it to get the download link.
Bear in mind that this is probably not a test that's worth performing in Selenium., it's probably a unit test in JavaScript land.
Since you can't get the link of the downloadable file from the html and verify the https status code because in your case - the downloading happens by javascript method
The only way to verify downloading in your case is to actually click the element and verify that the file was downloaded.
You also need to set the capability in ChromeDriver to download to default directory without asking.
Chrome Web Driver download files

How to test OpenLayers app with Selenium?

I know this is and oldie, and I apologize for that. But I still haven't found a solution to this.
I have recently tried to test my OpenLayers-based app with Selenium. But when I click on the map, it doesn't detect the click in Selenium. I have searched all over the Internet. Some people say it is a bug from Selenium, other claim to have found a workaround.
I have tried all these solutions and I am getting no results. The clicks still don't work.
http://osgeo-org.1560.x6.nabble.com/Testing-with-selenium-IDE-td5015680.html
Selenium IDE testing on maps(Open Layers)
http://comments.gmane.org/gmane.comp.gis.openlayers.user/18125
Could you please explain it better? Or maybe show an example?
Thanks
PS: I am new to Selenium, so it might be a bit more difficult for me to understand it.
I don't know if this is the best solution, but meanwhile I have started using Selenium WebDriver, more specifically, the Java version.
I have watched this video about automated tests and it helped a lot for getting on the right track. The video shows some examples of the use of Selenium WebDriver (the C# version, but it is similar to the Java version).
I have installed the ChromeDriver but you can also do it fully in Firefox.
I use JUnit for the tests.
In Selenium IDE, you "record" the tests and then you replay them.
Here, in Selenium WebDriver, you fully write the tests, without recording anything.
For example, you write code for the following steps:
1) Open the web page of my OpenLayers (or other) app.
WebDriver driver = new FirefoxDriver();
driver.get("http://localhost/myOpenLayersApp/index.php");
2) Click on the button that opens page X
driver.findElement(By.id("Button-Go-to-page-X")).click();
3) Checks if you have indeed navigated to page X
boolean check = driver.findElement(By.id("Header-X"))
.getText()
.equals("This is page X.");
Assert.assertTrue(check);
This was a very simple example of how to use Selenium WebDriver. At least, this is how I use it.
If you have more questions, please feel free to ask. :)
Note: Watch the video if you are new to this. It is a very good lesson about automated testing.

HtmlUnitdriver issues with Ajax content, I think

I have been testing an app using Firefox Web Driver but it is really slow comparing with HtmlUnitdriver, so I decided to translate to last one. All works fine but I have problems with some kind of links that loads information async.
In my case it is not problem of "wait" because I do and as i said before, using Firefox driver works very well. But with HtmlUnit doesnt work well.
In my scene I have following code:
Send
Viewing the app on a browser such as Firefox, when I click on that link, the system return me a result. But when I use HtmlUnitdriver, when I do click to the element, the driver goes directly to the href and then I have a bad result.
I don't really know how to do make works with it. I'm really interested on this way because is really fast.