How to bypass or avoid the download message - This type of file may harm your computer, Do you want to keep this file ? Using webdriverIO - selenium

I am trying to download an apk file using webdriverIO. I kept the following args and prefs for chrome, but still ath the end of download its prompting for the message - This type of file may harm your computer, Do you want to keep this file ?. How can I skip this ?
"goog:chromeOptions": {
w3c: false,
args: ["--reduce-security-for-testing", "--start-maximized", "--disable-gpu","--safebrowsing-disable-download-protection","--disable-web-security","disable-extensions","safebrowsing-disable-extension-blacklist"],
prefs: {
'directory_upgrade': true,
'download.prompt_for_download': false,
'prompt_for_download': true,
'download.default_directory': downloadDir,
"safebrowsing.enabled":true
}
},
Please dont mark this as duplicate, I tried the solutions provided by :
https://stackoverflow.com/questions/34130774/how-to-disable-this-type-of-file-can-harm-your-computer-pop-up
https://stackoverflow.com/questions/59840198/how-to-hide-the-warning-this-type-of-file-can-harm-your-computer-while-downloa
but nothing worked. Please help

Related

What is the default CSS property order?

i have been trying to find documentation on this but i havent been able to. I use stylint in a project and we have the css order option activated. I haven't been able to set up VS code to show the errors and i haven't found a page with the information to actually know the order,so i always need to check on compile time if i have any mistakes in the CSS order properties, and it shows a huge error on screen.
this are the stylelint rules we have
module.exports = {
extends: ['stylelint-config-standard', 'stylelint-config-concentric-order'],
rules: {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: ['mixin', 'if', 'else', 'include', 'extend']
}
],
'max-nesting-depth': 4,
indentation: 4,
// add your custom config here
// https://stylelint.io/user-guide/configuration
'selector-pseudo-element-no-unknown': [
true,
{
ignorePseudoElements: ['v-deep']
}
]
}
}
I dont see anything weird about it. It there a page where i can find the correct order? it is so annoying because when i get a stylelint order error, i usually have to find it in a few tries.
You are extending the stylelint-config-concentric-order community config. This config includes and configures the stylelint-order community plugin. You can find the order of the properties in the repo on GitHub.
You can see Stylelint errors in VS Code using the official Stylelint extension.
And you can have the extension automatically fix problems on save, which will include the order of your properties, using the editor.codeActionsOnSave configuration property:
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": true
},
"stylelint.validate": ["css", "postcss","scss"],
"css.validate": false,
"scss.validate": false
}
Alternatively, you can run npx stylelint "**/*.scss" --fix" on the command line to automatically fix problems.

How to disable prefetch in VueJS PWA?

When you generate a PWA app using vue ui you can expect the following behavior.
All files you have in your dist folder are precached by browsers.
In other words, when you navigate to your app a browser will quietly download all the files and cache it for further use.
The problem here is that browsers will also download async chunks which could never be used by a user. For example, I have an admin-settings route and a regular user does not need to download it at all.
Now I'm trying to disable this behavior, here's modified vue.config.js file:
module.exports = {
chainWebpack: config => {
config.plugins.delete('prefetch-index')
config.plugins.delete('preload-index')
},
pwa: {
workboxOptions: {
exclude: [/.*/],
runtimeCaching: [{
urlPattern: new RegExp('^https://example.com.*'),
handler: 'CacheFirst',
options: {
cacheableResponse: {
statuses: [200]
}
}
}]
}
},
...
}
Right now everything works as expected and browsers do not prefetch resourses. The problem, however, is that when I upload a new version of a file the app is not updated. Browsers still use the previos version of the file.
I'm stuck, any advice, good sirs?
P.S. Figured it out.
This line caused index.html to be also cached.
urlPattern: new RegExp('^https://example.com.*')
After changing it everything works as expected.
urlPattern: new RegExp('^https://example.com/.+')
Now the problem is that the old version of a cached file is not deleted from cache. The size of cache would grow a lot with each new deployment.
Any advice?

Change status of useTaobaoRegistry to false

I need to change the status of useTaobaoRegistry to false but I don't know how.
{
"useTaobaoRegistry": true,
"presets": {
"default": {
"useConfigFiles": false,
"plugins": {
"#vue/cli-plugin-babel": {},
"#vue/cli-plugin-pwa": {},
"#vue/cli-plugin-router": {
"historyMode": true
},
"#vue/cli-plugin-vuex": {},
"#vue/cli-plugin-eslint": {
"config": "standard",
"lintOn": [
"save"
]
},
"#vue/cli-plugin-unit-jest": {}
},
"cssPreprocessor": "dart-sass"
}
}
}
I tried doing vue config -e but it only showed :
Could not open .vuerc in the editor.
Unable to open '/home/prabin/.vuerc' null
Try setting the EDITOR env variable. More info: https://github.com/yyx990803/launch-editor
I visited the site but I understood nothing.
Any help would be nice !
I guess you have had your answer till now, but there is no concrete answer answer anywhere, specially for windows user. So, it will be helpful for future stackflowers.
Problem
You are getting the problem because there is no Default App to open such type of file extension. For example, we have Chrome, Firefox, IE for .HTML file extensions but the .vuerc file extension is not associated with any default app.
Solution
To make this work, first of all, you need to locate the file which is in your default user directory.
In windows C:\Users\{Username-Path}. Scroll down below, you will see .vuerc file. Double click on it and set you editor as Default App to open and open it.
After that, when you run, vue config --edit in terminal, the file will be opened in your predefined Editor. From there, you can make your desired changes.
Please try to change this "useTaobaoRegistry": false in ~/.vuerc file.
Right clic on the .vuerc file and choose : Open with > an "in-the-list" editor
Hope this will help you ;)

How to use Edge Chromium webdriver "unknown error: cannot find MSEdge binary"

I am trying to use the WebDriver for the Edge Chromium version with PostMan, but I cannot make it work.
WebDriver Download: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Doc: https://learn.microsoft.com/en-us/microsoft-edge/webdriver
I try to add the Edge Chromium and Webdriver in the system PATH environment variable and no difference. I think the selenium implementation in java work with the Edge Chromium Webdriver
msedgedriver.exe --port 9515
POST localhost:9515/session
{
"capabilities":{
"firstMatch":[
{
}
],
"alwaysMatch":{
"browserName":"MicrosoftEdge",
"platformName":"windows",
"goog:chromeOptions":{
"extensions":[
],
"args":[
]
}
}
},
"desiredCapabilities":{
"browserName":"MicrosoftEdge",
"version":"",
"platform":"WINDOWS",
"goog:chromeOptions":{
"extensions":[
],
"args":[
]
}
}
}
{
"value": {
"error": "unknown error",
"message": "unknown error: cannot find MSEdge binary",
"stacktrace":
"Backtrace:\n\tOrdinal0 [0x00007FF6678D7C52+1932370]\n\tOrdinal0
[0x00007FF66783CDA2+1297826]\n\tOrdinal0
[0x00007FF6677A0A51+658001]\n\tOrdinal0 [0x00007FF667710F1F+69407]\n\tOrdinal0
[0x00007FF66770EF02+61186]\n\tOrdinal0 [0x00007FF667737DBD+228797]\n\tOrdinal0
[0x00007FF6677351AF+217519]\n\tOrdinal0 [0x00007FF66771706F+94319]\n\tOrdinal0
[0x00007FF66771822E+98862]\n\tOrdinal0
[0x00007FF66785B531+1422641]\n\tGetHandleVerifier
[0x00007FF6679991E9+656297]\n\tGetHandleVerifier
[0x00007FF667998F81+655681]\n\tGetHandleVerifier
[0x00007FF6679A104C+688652]\n\tGetHandleVerifier
[0x00007FF6679999C3+658307]\n\tOrdinal0
[0x00007FF66785177E+1382270]\n\tOrdinal0
[0x00007FF66785D9D6+1432022]\n\tOrdinal0
[0x00007FF66785C84D+1427533]\n\tBaseThreadInitThunk
[0x00007FF909056FD4+20]\n\tRtlUserThreadStart [0x00007FF90AB5B1F1+33]\n"
}
}
The WebDriver should open and be able to execute other commands
I suggest you to refer steps below may help to solve the issue.
(1) First try to set the environment variable for your Edge (chromium) application.
(2) Try to open PowerShell window and try to launch the Edge web driver.
(3) Launch the Postman app and try to use http://localhost:9515/session as POST request.
(4) Add code below as body of the request.
{
"desiredCapabilities": {
"nativeEvents": false,
"browserName": "edg",
"version": "",
"platform": "ANY",
"javascriptEnabled": true,
"takesScreenshot": true,
"handlesAlerts": true,
"databaseEnabled": true,
"locationContextEnabled": true,
"applicationCacheEnabled": false,
"browserConnectionEnabled": true,
"cssSelectorsEnabled": true,
"webStorageEnabled": true,
"rotatable": true
}
}
(5) Try to send the request.
Reference:
SeleniumHQ/selenium
Notes:
Your environment variable should properly set and referenced to your
Edge (chromium) correctly.
Use the supported version of Edge web driver with your Edge
(chromium) browser.
This should really be a comment and not a full answer (ridiculous reputation system tbh); Anyway, to add to Deepak-MSFT's answer - after adding the environment variables be sure to restart your IDE.
I added my MSEdge directory to the PATH and Eclipse would still complain. Everything worked after I closed and re-opened Eclipse.
Also check if you are pointing to MSEdge.exe or the directory where MSEdge.exe is located. I noticed that it only works if you point to the dir and not the .exe.
So it would be something like: C:\Program Files (x86)\Microsoft\Edge Dev\Application\
I did face the same issue, and trust me I tried doing every possible thing, but you know what helped me, though it might sound lame to you, the Edge browser version it was old, when I updated it, it worked for me, the error was resolved, do give it a shot as well
Unlike Chrome browser it does not throws error lie the browser driver version and browser are incompatible.
Yours's sincerely,
A frustrated Automation tester

My nightwatch.js tests not runs in Chrome headless of CentOS

I run nightwatch.js tests using Nightwatch version 1.0.18 and It's working in windows environment but when I run it in centOS after installment of Xvfb I found below error.
Error while running .navigateTo() protocol action: invalid session id
Error while running .locateMultipleElements() protocol action: invalid session id
Error while running .locateMultipleElements() protocol action: invalid session id
Here is my nightwatch.json file code:
{
"src_folders": [
"./tests"
],
"output_folder": "./reports",
"custom_commands_path": "./custom_commands",
"custom_assertions_path": "",
"test_workers": false,
"webdriver": {
"start_process": true
},
"test_settings": {
"default": {
"webdriver": {
"port": 9515,
"server_path": "./node_modules/chromedriver/lib/chromedriver/chromedriver",
"cli_args": [
"--log",
"debug"
]
},
"skip_testcases_on_fail": true,
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args": [
"headless",
"no-sandbox",
"disable-gpu"
]
}
}
}
}
}
am I missing something to run my tests in the centOS environment because it is running in the windows environment?
I had the same issue with Nightwatchjs and the npm chomedriver setup.
Background:
Everything was working until I just recently updated Chromium on my system. In addition to the errors in the original post, verbose logging also showed:
{
message: 'unknown error: Chrome failed to start: exited abnormally',
error: [
"(unknown error: DevToolsActivePort file doesn't exist)",
'(The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)',
'(Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.9.0-8-amd64 x86_64)'
],
}
After downloading the standalone chromedriver (2.46.628388) to match my Chromium version (72.0.3626.69) it was still showing the same errors.
Solution:
I ended up downloading an older version of Chromium (71.0.3578.127) and setting chromeOptions.binary to the new path of the chromium 71 binary. I also had to include 'no-sandbox' with chromeOptions.args.
Here is the snippet from the site mentioned above:
Downloading old builds of Chrome / Chromium
Let's say you want a build of Chrome 44 for debugging purposes. Google does not offer old builds as they do not have up-to-date security fixes.
However, you can get a build of Chromium 44.x which should mostly match the stable release. Here's how you find it:
Look in https://googlechromereleases.blogspot.com/search/label/Stable%20updates for the last time "44." was mentioned.
Loop up that version history ("44.0.2403.157") in the Position Lookup
In this case it returns a base position of "330231". This is the commit of where the 44 release was branched, back in May 2015.*
Open the continuous builds archive
Click through on your platform (Linux/Mac/Win)
Paste "330231" into the filter field at the top and wait for all the results to XHR in.
Eventually I get a perfect hit: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Mac/330231/
Sometimes you may have to decrement the commit number until you find one.
Download and run!
Upgrading to the latest version of chromedriver solved the issue for me. You can find the latest version here; https://www.npmjs.com/package/chromedriver
In my situation, when that error occurs:
Error while running .navigateTo() protocol action: invalid session id
I added the following code into .travis.yml:
addons:
chrome: stable