prevent watir-webdriver running chrome as a first run - google-chrome

Everytime I use watir-webdriver to initialise a chrome browser instance, it launches as a first-run with an EULA pop-up and an additional getting-started tab open.
Both of these side-effects are preventing me from automating tests for chrome.
I have tried initialising a browser using just
Selenium::WebDriver.for :chrome, :switches => %w[--no-first-run]
but have the same result.
I am surprised to be unable find any other questions online about this, so assume I have done something weird!
I have placed chromedriver.exe in C:\Program Files (x86)\Google\Chrome\Application which is on my PATH variable.
Any ideas?

I have found a solution for this. In C:\Program Files (x86)\Google\Chrome\Application there is a file called master_preferences.
Opening this file and setting:
require_eula to false
show_welcome_page to false
fixed both issues for me.
Hopefully this helps someone!

I would put the chromedriver.exe on your PATH, so somewhere like C:/windows/system32 or the like, or you could add the directory
C:\Program Files (x86)\Google\Chrome\Application
to your PATH (right click My Computer -> Advanced -> Environment Variables)
It should then run OK.

Related

Console command for opening files inside already opened project in PhpStorm

I've faced the problem. I use PhpStorm to edit files from FTP server using WinSCP client. In WinSCP client I've set command for using external editor. So, when I try to open php-file from remote FTP server WinSCP downloads this file in temporary file and open it using command provided by me - "C:\Program Files\JetBrains\PhpStorm 2020.1.1\bin\phpstorm64.exe" "!.!"
Earlier, when I used PhpStorm 2019 or 2018, it opened file in already opened window/project. But when I've upgraded to PhpStorm 2020, it started to open file from FTP in separate windows. It's so annoying and some functionality doesn't work in such case (auto suggestions and others).
I know that I can use built-in remote files browser within PhpStorm to view and edit remote files, but I accustomed to use separate FTP client for such purposes.
Does somebody know how to fix this problem? What console command should I use so as to open separate file in already opened window/project?
It's a LightEdit mode: https://blog.jetbrains.com/idea/2020/04/lightedit-mode/
Since 2020.2 you can use the -p (--project) option instead to force opening files in already opened project windows. For example idea -p myfile.txt. IDEA-237118
You can also permanently disable that mode by following these steps:
Invoke Help | Find Action... (or via Search Anywhere: use Double Shift and switch to Actions tab)
Search for Registry... action and select it
Once in the Registry dialog locate light.edit.file.open.enabled entry (just start typing, speed search will narrow it down) and set it to false (uncheck the box).
Not sure if IDE restart is needed (probably not).

PhpStorm Debugger never enters code, but page doesn't finish loading while debugger is running

I am using PhpStorm on Ubuntu which I'm running on a Hyper-V machine. I'm trying to configure the PhpStorm debugger with XDebug. I've set a breakpoint in my code, but when I click "Start Listening for PHP Debug Connections" in PhpStorm and refresh my page, the debugger never enters my code. The debugger must be doing something because the page in the browser stays loading, until I click Stop in PhpStorm. If I don't click for the debugger to listen for connections, the page loads correctly.
The Debug window shows the error Remote file path '/var/www/magento2/pub/index.php' is not mapped to any file path in project, but I don't know how to get that to map correctly. In the path mappings windows, under "Include path", it shows a bunch of paths, but the path /var/www/magento2/pub isn't there. I can't find anywhere to add an additional path. Could this be a permissions issue for that folder? What permissions do I need to allow PhpStorm to map that path?
If I uncheck "use path mapping" in Preferences > Language & Framework > PHP > Servers and leave "Break at first line in PHP scripts" checked, then the debugger breaks on the first line of code, but I don't want to break until my breakpoint is hit.
If I uncheck "use path mapping" and don't check "Break at first line in PHP scripts", then I get the error Debug session was finished without being paused. It may be caused by path mappings misconfiguration or not synchronized local and remote projects. To figure out the problem check path mappings configuration for 'mydomain.local' server at PHP|Servers or enable Break at first line in PHP scripts option (from Run menu).
Here's my XDebug configuration
zend_extension=xdebug.so
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.var_display_max_depth=-1
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.idekey="PHPSTORM"
Update:
Here are the responses to #LazyOne's questions
1) The path to the project root is /var/www/magento2
2)
One thing here which I think may be related to the problem is that under Include Path, the /var/www/magento/pub directory is not shown. That's what PhpStorm is referencing on that first error I described above. It's like PhpStorm found some of my directories with PHP files, but not all of them.
3) Here is the XDebug log
Update 2:
Here is what my project looks like
Here is my Directories window
I'm assuming that the reason that all the vendor/... directories are under Excluded Folders is that they are in .gitignore. Some of the code that I'm setting a breakpoint in is in a subdirectory of one of the vendor directories and some of the code is in a subdirectory of app/code/ (which is under Source Folders)
I added /var/www/magento2/pub to the Include Path under Settings > Languages & Frameworks > PHP. That eliminated the error about /var/www/magento2/pub/index.php. Now it's partially working. If I have PhpStorm break on the first line of PHP scripts, the debugger does start as soon as I refresh my page. However, after I step over the first line of code, I get the error PHP CS Fixer: Can not correctly run the tool with parameters... and then the debugger seems to stop working.
If I don't select Break at first line in PHP Scripts, and I put a breakpoint further into my code, I still get the same "debug session was finished without being paused" error.
I'm not sure what PHP CS Fixer is, nor do I want it to run. Is there a way to disable that?

Default location of ChromeDriver binary and Chrome binary on windows 7

What is the default location of ChromeDriver binary and Chrome binary on windows 7 for triggering appium using java-client.jar? if i am using RemoteWebDriver and tries to initiate chrome browser, from where does the selenium initiates the chromedriver?
the code:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("userName", ReadProperties.Properties("MobileUsername"));
capabilities.setCapability("password", ReadProperties.Properties("MobilePassword"));
capabilities.setCapability("udid", ReadProperties.Properties("MobileUID"));
capabilities.setCapability("browserName", ReadProperties.Properties("MobileBrowser"));
capabilities.setCapability("platformName", ReadProperties.Properties("MobilePlatform"));
log.Info(capabilities.getVersion());
mobile_driver = new RemoteWebDriver(new URL(""+ReadProperties.Properties("MobileURL")+"/wd/hub"),capabilities);
chromedriver is not installed in your System by default. Users individually have to download chromedriver from ChromeDriver - WebDriver for Chrome page and you can place it anywhere within your system.
You must ensure that Chrome is installed at the optimum location as the server expects you to have Chrome installed in the default location for each system as per the snapshot below :
Note : For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary. You can also override the Chrome binary location following the documentation Using a Chrome executable in a non-standard location.
The location will depend on your default download folder e.g. when you download something from the internet and it goes into the downloads folder, then that is your default download folder.
So if you downloaded chromedriver.exe the same way, then it will also be in the downloads folder.
If you are using 3rd party service to run your tests you should not care about chromedriver.
But when you run tests locally you have to download it yourself: https://chromedriver.storage.googleapis.com/index.html
And then use capability to set absolute path to this file.
Make sure you use chromedriver version compatible with your browser version.
I know it's an old question but none of the answers above helped me. I found a different solution that worked for me and it might help someone else in the future.
I have tried the below solution with only Windows 10 / Server 2016.
Step 1: Get to the Google Chrome install directory by right clicking on the Chrome icon and click on Properties. You will see the installed directory listed under 'Target' and 'Start in' options. The directory path should end with .../Chrome/Application/. Copy the whole path.
Step 2: Open File Explorer and go to the above copied path. You should see chrome.exe file with other files and folders. Copy the whole Application/ folder including chrome.exe file with other files and folders.
Step 3: Go to the below file path and paste the above Application folder.
C:\Users<YOUR USER>\AppData\Local\Google\Chrome\
After pasting the Application folder, you should have the chrome.exe file with other files and folders in the following file path:
C:\Users<YOUR USER>\AppData\Local\Google\Chrome\Application\
Now the ChromeDriver should be able to locate the Chrome Binary.

Texture Packer won't run

I downloaded texture packer here https://code.google.com/p/libgdx-texturepacker-gui/downloads/detail?name=gdx-texturepacker-3.2.0.zip&can=2&q=
When I run the .jar file it just shuts down before even displaying the gui. Is anyone experiencing a similar problem? I am running OSX El Capitan.
The project is quite old so you can try it's successor: gdx-texture-packer-gui.
[The] project is a successor of Aurelien Ribon's project with whole new
GUI and features.
You can download the tool here:
https://github.com/crashinvaders/gdx-texture-packer-gui/releases
Do you have the Java runtime environment installed on your computer or just the Java development kit? I don't use the texture packer, but I had a similar problem with the Android SDK manager (it shut down before displaying the GUI) on a new computer where I had only installed the Java JDK. After installing the JRE then it worked fine.
Try this: Create a txt file and change its extension to ".bat". Right click to file and select modify. Copy this into file:
"java -jar "C:\Users\fat2019\Desktop\gdx-texturepacker-3.2.0\gdx-texturepacker.jar" Change path to your own where gdx-texturepacker.jar file is. Then save and close. Double click file.
edit: this is for windows.
I have the same problem. Using Windows 7 I have to do this:
Go to your java directory and copy your java path
C:\Program Files\Java\jdk1.8.0_40\bin
Right click on my computer,
Click properties
Go to "Advanced system settings" click ,
Click on Environment variables.
Go to System variables section, and you will find an entry called path.
Double click on path
Add a semicolon (;) to the end of that line
After the semicolon paste your path previously copied: C:\Program Files\Java\jdk1.8.0_40\bin
Apply
It must be enough. Your file should run at this point.
Double click it and go to the end, put a semicolon and paste your path, apply and ok. It should run now.
For Mac I downloaded the free version of https://www.codeandweb.com/texturepacker/download
This saves as .txt rather than .atlas for some reason.
After adding the animation I got errors in batch.draw ... casting to TextureRegion fixed that.
As always, I have no idea if this will cause problems later but there you go. Looks good so far. :)

Open google chrome (all users installation) in kiosk mode from terminal

I execute this in order to open Google chrome in kiosk mode:
"C:\Users\Javier\AppData\Local\Google\Chrome\Application\chrome.exe" --user-data-dir=$(mktemp -d) --kiosk "url"
but, what I need to modify if google chrome is installed in Program Files(x86)? If I execute:
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=$(mktemp -d) --kiosk "url"
I get an error in --user-data-dir=$(mktemp -d) sentence.
Thanks in advance.
Javier
I think there may be no elegant solution at this point. "mktemp -d" is a linux/unix command and I can't find it, or an equivalent, on windows. It may have worked at one time (I stumbled on mktemp on a microsoft development page), but on 8.1 it didn't. The error I was getting said it had to do with permissions, but that wasn't the case.
If someone could get commands in Cygwin working at the windows command prompt then maybe the above would work. Another option may be to create something for PowerShell that does the same and plug that in there.
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=c:\somedir --kiosk "some.url.here" does work though. It works from a shortcut, so it should also work from the command line, but you do lose the random temp directory.
For my case, I just wanted some websites/web-apps to default full screen (F11) from a shortcut and I'd just Alt-F4 to close, and Alt-Tab between them and the desktop. As it is, I'm thinking I'll have to make a separate data-dir for each one I want to do.
I was using the command chrome.exe --user-data-dir=$(mktemp -d) --kiosk http://someUrl/ and it was working well for over a week until I started testing my program with a limited privilege user today. I noticed that chrome process itself did not start after calling process.start() method. There were no entries in event logs to see what went wrong. After looking at your solution, I changed my program to generate a temp folder using C# command pass it as an argument and it started working. Thanks for the help. This is the simplified version of the code I use.
DirectoryInfo tempDirectory = Directory.CreateDirectory(Path.Combine(Path.GetTempPath(), "Chrome" + DateTime.Now.ToString("ddMMHHmmss")));
Process process = new Process();
process.StartInfo.FileName = GetBrowserPathFromRegistry();
process.StartInfo.Arguments = String.Format("--user-data-dir={0} --kiosk {1}", tempDirectory.FullName, this.uri);
process.Start();