How to customize the file name or get the file name of the saved mp4 file under video output folder of a specific test using selenium grid extras - selenium-grid

Enabled video in the selenium grid extras config json file and able to see mp4 videos saved under video output folder.
How do I get the saved mp4 file name of a test programatically ?
Also, is it possible customize the file name to give it a meaningful name like testname_dateofexecution ?

RemoteWebdriver has a method GetCapabilities. Capability 'webdriver.remote.sessionId' returns the session id which is the file name of the mp4 file created in video output folder

Related

Selenium WebDriver Chrome change fake video device name

There is a problem when you use video substitution, the device is defined as a video title file.
That is:
options.add_argument("--use-fake-device-for-media-stream")
options.add_argument("--use-file-for-fake-video-capture=video_camera.y4m")
device name 'video_camera.y4m'
The documentation says https://peter.sh/experiments/chromium-command-line-switches/ That two types of files can be used "mjpeg" or "y4m"
But you can't use a symlink, for example. I.e. you need to change the path to the file to a file without an extension.
What options can I use?

How to open a disk file with Capacitor?

I'm saving a file by running the following code with Capacitor:
Filesystem.writeFile({
path: fileName,
data: content,
directory: FilesystemDirectory.Documents,
//encoding: FilesystemEncoding.UTF8
});
Now, I would like to open it (it's a pdf). However, I don't see anything in FileSystem documentation about how to achieve that? I'm missing a FileOpener function.
The goal is that it gets opened with whichever pdf app the user has in the phone.
I'm using Vuejs.
I hope that this is helpful to you, a package for capacitor to read pdf. https://www.npmjs.com/package/capacitor-pdf-viewer-plugin

Failed- Path too long error while downloading file in Chrome using selenium

I want to download file in my current working directory using selenium automation. But I am getting 'Path too long' error. The code I have written so far is:
os.chdir(os.path.dirname(__file__))
current_directory = os.getcwd()
windows_cwd = current_directory.replace('\\','\\\\')+'\\\\'
chrome_options = webdriver.ChromeOptions()
prefs = {'download.default_directory': windows_cwd,
'download.directory_upgrade': True,
'safebrowsing.enabled': False,
'safebrowsing.disable_download_protection': True
}
chrome_options.add_experimental_option('prefs',prefs)
browser = webdriver.Chrome(options=chrome_options)
My current working directory is:
C:\Users\US177\PycharmProjects\Plugin
where the path is too long.
But it successfully downloads to
C:\Users\US177\Desktop
failed-long path
I'm not exactly sure what your question is based on the information provided, but I'm guessing it's along the lines of "Why is this happening?", so I will address that question.
The maximum length of a file name in Windows is 260 characters. The file is able to download to your desktop because the name of the file (when appended to your path) does not exceed this limit. When trying to download to PycharmProjects\Plugin\ folder, the path has become too long.
While setting your download path, try using double backslash (ie. path\\to\\directory).
See this Github issue about programatically downloading from chrome

Getting content length is not supported in Yii EAjaxUpload

I am using Yii EAjaxUpload extension to upload files. I am facing a problem during uploading image. 'Getting content length is not supported'. In console It is showing the error "http://46.101.98.121/MyApp/index.php?r=controller/upload&PHPSESSID=j7…KEN=077cb06478a3c70e40a2a01dc4cb1a94a6ff96ec&qqfile=518164-backgrounds.jpg". In php.ini 'upload_max_filesize' and 'post_max_size' both are 100MB. File is already uploaded to the destination folder but the uploading procedure fails each time. Please help.

How to get html content remotely and open locally

I want to get the content remotely for a html page and open locally in the webview. But I want this html to have access to the Ti namespace, so it implies that the html must be running locally.
Have tried to create the webview passing the content as the "html" parameter, but Ti namespace doesnt work that way.
Then, I tried to write the content to a html file on Ti.Filesystem.applicationDataDirectory. The page opens OK, but the Ti namespace doesnt work on the html either.
Finaly, I created a html file in assets folder on the project and when I get the html code I try to write on it so I could open using 'url' : '/myfile.html'. But when I try to write it gives java.io.IOException: read only
How can I achieve this? Again: I'm trying to get a html content remotely and run locally so I can have access to Ti namespace.
Thanks
I messed up during my testings. Downloading the html and then opening the webview passing the html code to "html" parameter on the webview works just fine. The fireEvent works that way inside the html.
It was not working because it was other problem not related that I fixed.