How download exe files with ChromeDriver? - selenium-webdriver

I try to download exe files via ChromeDriver. But I see the following message: "This type of files can harm your computer..."
How I can avoid this message?

I don't think that we can switch off those messages in Chrome.
But i have a workaround.
1) chrome://settings/ --> Downloads --> Select the "Ask where to save each file before downloading" check box. Then every time before downloading a file chrome will ask you where to save the file & the default location is "Downloads" folder.
2) Write an AutoIt script just to press ENTER (As the focus is already on the popup).
Send("{ENTER}")
3) Once you click on the Download link, Run the above AutoIt Script using below command:
Runtime.getRuntime().exec("Path of the AutoIt executable");

It's fine to download files. It will shows such error for .js, .exe, .dll, excel macro files etc.
Things need to remember is when you try to install the software with any installer when you double click the exe file it will show you publisher name. If publisher is unknown it may possible that exe file is altered.
Most of the trusted software publishers use Code Signing Certificate to validate their software package. This way software shows their company name as a publisher, and assure that the software is not altered.

Related

ONLYOFFICE and mime-types assosiasions

I`m using Elementary Os Loki and wanted to use ONLYOFFICE.
I tried installing the last deb file from official site and tried to use the repo(no change). The problem is that when the package installs it doesn`t register itself to allow opening the file from filemanager or terminal(desktopeditors -f example.doc or smth).
I found whole dir in the official repo where I think all logic is handled.
(https://github.com/ONLYOFFICE/desktop-apps/tree/master/win-linux/package/linux/qt-installer/packages/onlyoffice/data)
I also tried to fix by changing file in /usr/share/applications - defaults.list and desktopeditors.desktop.
Please fix this or give a nice explaination if it a feature.
The only way to open a file is to use internal file chooser dialog or to drag&drop a file on the window.
It is a bug in onlyoffice-desktopeditors. We will fix it soon. You can set file associations: open context menu of the file, choose "open with" -> "other applications". Then find 'desktopeditors' in recommended applications, select this and press 'Set as default' button.
After this you will be able to open files from file manager in ONLYOFFICE.

NSIS simple copy one file from another folder in program files directory to installation dir not working

I tried to create an installer to install a application.
The basic stuff works fine, but I have problems, when it comes up to simply copy an existing files, which is located in some subfolder of Program Files folder.
The scenario behind this, is that the application has different versions and a license file.
When the app gets installed, the installer looks for an existing file, and if exists, should just copy that license file to the $INSTDIR/license folder.
Example:
C:\Program Files (x86)\MyApp\Ver1.0\license\ // here's the location of old license file
C:\Program Files (x86)\MyApp\Ver2.0\license\ // here to put the old license file
Following section is condensed to the relevant stuff:
Section "License of other Version"
IfFileExists '$PROGRAMFILES\MyApp\Ver1.0\license\some_license.slc' beginLicense endLicense
Goto endLicense
beginLicense:
MessageBox MB_OK "We have found an old license file. Do you wanna to use it for current installation ?"
CreateDirectory "$INSTDIR\license"
CopyFiles "$PROGRAMFILES\MyApp\Ver1.0\license\some_license.slc" $INSTDIR/license/some_license.slc"
endLicense:
MessageBox MB_OK "There were no license found."
SectionEnd
The compiling runs fine, but the installation process denotes an error when trying to copy the file. But it gives no further explanation, why it failed.
I tried also using the File directive, but that produced other errors, because of using the constants in file directive (file not found, and that sort of errors) and even the script cannot compile.
I tried also using a macro, mentioned here in another question of stackoverflow (sry, didnt have the link anymore), but it didnt worked for me, too.
What am I doing wrong, is it not allowed to use constants in CopyFile directive ?
Any help is appreciated.
You need to change:
CopyFiles "$PROGRAMFILES\MyApp\Ver1.0\license\some_license.slc" $INSTDIR/license/some_license.slc"
To:
CopyFiles "$PROGRAMFILES\MyApp\Ver1.0\license\some_license.slc" $INSTDIR\license\some_license.slc"
NSIS is not a fan of / slashes. While most of the low-level kernel32 functions can handle them, not all things in the shell can and that probably includes SHFileOperation used by CopyFiles. Even if that was not the case, internal path processing in NSIS tends to eat / slashes...

Run .bat as a Windows Service

I'm here again with another case that is getting me out my mind.
So, this is happening, I'm trying to run an executable java class(.jar) as a Windows Service, and all my attempts failed so far. To make it a little easier, I turned my jar into a batch file, wich only executes the jar in background, here is the code:
start "" javaw -jar C:\LocalService.jar
The batch works fine. However I have tried to install this batch as a service by using the next line in cmd:
sc create "LocalService" binPath= "C:\LocalService.bat"
The Service installs correctly, but as soon as I try to start it, it pops up an error (The code error is 1053, says something about the service did not start correctly)
Also, I have try with a software called NSSM (non-sucking service manager) It installs fine too, but the service does not start either.
Do you guys know what am I missing?
By the way, I'm doing all this on Windows 7 Professional.
Thanks!
thanks for your comments
Both tools didnt work for me, sadly. However I was able to do it with a software called Java Service Wrapper. This is not a free software, so I needed to buy a license to get it to work.
The steps were simple:
1.-Create a folder with the name of the service, then inside add 4 folders: lib,bin,logs,conf
2.-On the lib folder you have to copy your jar and also the wrapper.jar and wrapper.dll (these last two are in the zip you download from the website)
3.-Copy 4 files to the bin folder: InstallApp-NT.bat.in, App.bat.in, UnintstallApp-NT.bat.in and wrapper.exe (this last one is the one that defines your license, if you can get a file wrapper.exe from somebody else who had paid a license it will work fine. These file also came in the zip from the website) Remove the .in from the batch files
4.-The most tricky step is this: You have to copy from the wrapper's folder called conf a file called wrapper.conf.in Remove the .in extension and edit it with a tex editor. The most important lines you have to edit are:
wrapper.java.command=C:\Program Files (x86)\Java\jre7\bin\java //Specify JRE Path. Will work with eviroment variable
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperJarApp //Choosing this class means your are using a .jar file to execute when the service starts
wrapper.java.classpath.1=C:\LocalService\lib\wrapper.jar //This one is constant.
wrapper.java.classpath.2=C:\LocalService\lib\LocalService.jar //This is the path to your executable jar
wrapper.java.library.path.1=C:\LocalService\lib //Path to your own lib folder (the you created at the begining)
wrapper.app.parameter.1=C:\LocalService\lib\LocalService.jar // again the path to your jar
Then just execute the InstallApp-NT.bat and start the service and your are done
It worked to me with absolute paths, however according to documentation it will work fine with relative path too.
This is how I solved my problem and I hope someone with the same issue will find this helpful
See you next time!

Error when execute within a TFS build definition

When I tried to call command-line to get latest update for my TFS mapped folder
TF get /recursive
The call complete successfully from the run window of Windows 7.
However, when I put the call into a .bat file and run it via InvokeProcess within a build definition (guide to do that), it failed.
The message is as below.
Unable to determine the workspace. You may be able to correct this by
running 'tf workspaces /collection:TeamProjectCollectionUrl'
What happens? How can I get around with that?
The reason this is happening is because when you run the command locally, the folder you're downloading is mapped to a workspace. When you execute the command in your build, it's running under the build service account, which doesn't have a workspace mapped for the folder you're specifying.
You shouldn't need to use the tf get command as part of your build. When you configure your build, you can specify which folders should be mapped in the workspace on the "Source Settings" tab. The build process will handle making sure the contents of the folders you map in your workspace are present automatically.
The cause for my issue is that the build agent execute my .bat file under a different Windows account which is something like NTSERVICE; when I run it directly, my TFS login account was used (which was previously remembered in Windows 7 Credential Manager)
So the solution is to put in the login name and password as TF get /login:SomeTFSUsername,SomePassword (see more here)

what does "Connecting to database specified by database.yml" in the log file mean?

I'm working on a Rails 3.2.9 app , on performing a certain action, the app doesnt go any further and when i chech the log file i get this line to be the last in the log
Connecting to database specified by database.yml
I have no idea what's causing this problem.. When i sign up or sign in also it needs to connect to db and it works fine then.. only when a function (called execute test case) is clicked, the app doesnt go further and freezes there itself..
Please help me if you have come across this ...or suggest what may be the cause!!
Check this answer. This may help you.
Rails Connecting to database specified by database.yml
I found the cause of this error.. Problem is when the gem ‘mysql2’ is installed for the app , it might not be the one compatible with the version of MySQL server that is installed in our machine. And also a corresponding libmysql.dll file to be copied to Ruby folder.
So install the gem by specifying the local directory of Mysql
1.In the cmd,
gem install mysql2 -- --with-mysql-dir=C:\Program Files\MySQL
As directed in the cmd, follow the link to download the dll. Extract the zip from that location and copy the file as instructed in cmd
If the zip is empty or the link shows file not exist.(which does happen for some versions!!)
--> Go to the link and follow the flow in the url.. Like the website.. http://dev.mysql.com ->downloads -> MySQL Connectors -> MySQL Connector/C -> the latest version zips are displayed.. Choose the one with the exact file name as in the empty zip/broken link. If not click on previous GA versions and find the according zip file. Download, extract and copy the libmysql.dll to Ruby’s bin folder

Resources