Selenium/Chrome - Launch w/ Profile, save no data - google-chrome

Initiating driver with selenium without any arguments on the profile will lead you to clean chrome profile: nothing added, copied,synced, logged, installed.
When you load a profile - it starts using it like it's a default profile - it loads whatever it has , have all installed stuff. But it also SAVES data.
Is there a way to launch a profile with Selenium/Chrome but save NOTHING to it, so it will beused like an empty profile - Launched, used, all changes discarded, launch again and have nothing changed?
INCOGNITO Doesn't work as it blocks some features.(e.g several extensions cannot be interacted with when you are in incognito)

There are two possible options that I can think of
Copy the profile
One is to have a copy of the profile and use that to load the browser
So /profiles/common_profile has your profile and when you want to launch chrome your will create a copy of the same to /profiles/browser_profile
Use git in profile
You can do below in your default profile
git init
git add .
git commit -m "Default profile"
After the browser is done you can do a
git reset --hard

Related

Deploying libgdx to html

I tried deploying Libgdx to html using gradle. I copied the content
html/build/dist
and all I see in the browser is the badlogic image with a red background (what you would see if you just created a project) Why is that?
Using the superdev I can open it in the browser, i see where it says drag this button but can't play it. there's nothing
The code server is ready at http://127.0.0.1:9876/
GET /clean/html
Cleaning disk caches.
Cleaned in 29ms.
GET /superdev.html
[WARN] ignored get request: /superdev.html
[WARN] not handled: /superdev.html
> Building 91% > :html:superDev^C%
turning the dev mod on I see Can't find any GWT Modules on this page.
If I build it normally, I see some warnings about depreciated methods, it builds successfully.
Assets aren't being loaded by html
I've few links that may be help you :
How to start
Super Dev mode in GWT
Also check this thread
https://stackoverflow.com/a/24265470/3445320
EDIT
I've tested on Android Studio with MacOS
Steps :
Run ./gradlew html:clean to clean your html module
On Android Studio Terminal I run ./gradlew html:superDev command
I got The code server is ready at http://127.0.0.1:9876/ on terminal
Then I open Google Chrome, View -> Always Show Bookmarks Bar
I typed http://127.0.0.1:9876/ in adress field -> enter
I got a page having Dev Mode On and Dev Mode Off, two buttons
Drag Dev Mode On to bookmarks bar, that is below my Address bar
Done! now I search http://localhost:8080/html/ , I got my game in browser
Press Dev Mode On button that is in bookmarks bar, I got option for compile
Now I need to deploy my html project
I run ./gradlew html:dist in Android Studio Terminal
I got BUILD SUCCESSFUL in Terminal then I find dist folder inside my html module.
dist folder is inside html module -> build -> dist
I copied dist folder and deployed to my server.
EDIT 2
Make sure badlogic.jpg is in your assets folder of android module
Check entry in assets.txt file and find badlogic.jpg inside html module->war->assets folder. If file or entry not exist.
Somehow program not able to write in assets folder
Check what programs have the file/s open
Check permissions and administrative rights
Delete the cache files, run "gradlew html:clean html:superDev" for every new run of superDev.
Check any anti-virus software, they can flag some of GWT's behaviour as suspicious

Chrome Adobe Flash is out of date

I keep getting this browser (chrome) notification saying
Adobe Flash Player was blocked because it is out of date. Update, Run This Time
If I click run this time it allows me to run any flash content on current page but same notification on new page. If however, I click update plugin it takes me to this Chrome support page. I follow instructions and go to chrome://plugins which give me a url under Adobe Flash Player which is following Download Critical Security Update and as you see this again links me to the Google support page with instructions on how to update and that I've already been on.
I encountered the same issue with Chrome on my Linux system.
Here is my solution for Linux system:
Install chrome 55+, if you have an older version.
Download flash player,
url: http://get.adobe.com/flashplayer/
step 1 - os
choose "linux 64 bit",
step 2 - version
choose "FP xx for linux 64-bit (.tar.gz) - PPAPI",
Download,
Uncompress,
Copy files in the directory into ~/.config/google-chrome/PepperFlash/,
Make it executable via: chmod +x libpepflashplayer.so
Append parameter to chrome's start command,
Where is the command:
(1) for icon,
right click icon -> properties, there is "command" input,
(2) for shortcut,
config the shortcut,
The parameter to append is:
--ppapi-flash-path=/home/eric/.config/google-chrome/PepperFlash/libpepflashplayer.so
e.g.
/usr/bin/google-chrome-stable %U --ppapi-flash-path=/home/eric/.config/google-chrome/PepperFlash/libpepflashplayer.so
Restart chrome,
Now the flash should work.
I assume you have solved your issue by now, but for the benefit of others: Flash is now provided as a so-called component and updated separately from the main Chrome application. I would therefore suggest first checking chrome://components and manually check for an update there.
By the way, the same is true for the Widevine DRM component, which if not up-to-date may stop Netflix, etc. from running.

Parallel testing with UI Testing Xcode

Can I open multiple simulator on the same mac in order to do parallel testing using UI Testing from Xcode?
Update May 2018:
Bluepill allows tests to be split across multiple simulators and supports XCUITests:
we recently added support for Xcode UI Testing bundles. Thanks to the
inspiration from FBSimulatorControl. Bluepill now supports Xcode unit
test bundle and UI test bundles.
Original answer:
There doesn't seem to be a viable solution at the moment. However promising tools are coming into place. There's a framework called FBSimulatorControl and it's cli tool called fbsimctl which allows you to boot multiple simulators at once, and install & run apps.
With fbsimctl you could build you target application & install it on each simulator. The part I'm stuck on is how to build & install the companion XCTestUI runner app.
xcodebuild doesn't appear to allow building the XCTestUI runner app without invoking the test action (causing alerts that multiple simulators are open). If xcodebuild could allow the building the .app/.ipa for the runner app only, then it looks like fbsimctl could handle the rest.
There's also an open issue over at facebook/xctool trying to work through this problem.
Parallel UI testing is possible if you use multiple users on your mac and some kind of a continuous integration system. If done correctly you can run your UI test suite on a variety of device simulators at the same time. In other words you'd be able to run all your UI tests against many devices in the time it takes to run those tests on one device - which is what I think we're trying to accomplish here. The following are instructions on how I was able to get parallel UI tests up and running with gitlab-ci-multi-runner. These instructions assume you have never used any of the tools but are not instructions on how to write UI tests:
Install Xcode through the mac app store.
Open the mac app store.
Type "Xcode" into the search field
Navigate to the Xcode install page and click "Install"
Note: I used Xcode 8.2 at time of writing this.
Install the Xcode command line tools.
Open terminal and enter the following command xcode-select --install
Note: You will be needing Xcodebuild, so this step is critical.
Create a few new "test" users on your mac.
Open system preferences and click on "Users & Groups".
Click the lock icon on the bottom left of the window to make changes.
Enter a "User Name" and "Password" and then click "Unlock".
Click the "+" add button located at the bottom of the list of users on your mac.
Select "Administrator" in the "New Account" dropdown menu.
Give your user a name in the "Full Name" text field (i.e. Test User One)
Click on the "Account Name" text field and allow it to auto fill.
Enter a password of your choosing into the "Password" text field.
Re-enter the password into the "Verify" text field.
Optionally enter a password hint into the "Password Hint" text field.
Click "Create User".
Repeat step two several times. Note: the number of users you create will determine the number of devices will run through your UI test suite at a time. In this solution we will discuss just running tests against several different devices at once on a single mac.
Create an account on gitlab.com.
Create a new project on gitlab.
Here is a tutorial on how to do that.
Follow the "Command line instructions" on your new project detail page to move your Xcode project into a gitlab repository.
Create SSH keys for each test user:
Sign into each of the "test" user accounts you just created. Note: It is important each user be signed in so the gitlab-ci system can run tests on that user. If not the tests will fail.
Open terminal again and type ssh-keygen -t rsa
Follow this tutorial complete this process.
Navigate to your gitlab "Profile Settings" page and then to the "SSH Keys" tab.
Use pbcopy < ~/.ssh/id_rsa.pub in terminal to get your generated SSH key in each 'test' user account and then use cmd+v to paste each the SSH key into the "Key" text field on the "SSH Keys" tab in gitlab.
Note: It is critical for each 'test' user to have access to your project code in gitlab so don't skip this step for any of your test users.
Note: I personally like to test each user has access to the repo by doing a git clone while logged into each of the "test" users.
Create test "runners" on/for each of your "test" users on your mac.
Open your gitlab project page on gitlab.com.
Click on the project settings icon.
Click on the "Runners" link.
The important information on this page is the URL and registration token highlighted in red under the "How to setup a specific Runner for a new project" section of the page.
Open terminal and type sudo curl --output /usr/local/bin/gitlab-ci-multi-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-darwin-amd64 then hit return.
Type sudo chmod +x /usr/local/bin/gitlab-ci-multi-runner then hit return.
Type gitlab-ci-multi-runner install then hit return.
Type gitlab-ci-multi-runner start then return.
Type gitlab-ci-multi-runner status then hit return to ensure the service is running.
Type gitlab-ci-multi-runner register and hit return.
Copy and paste the URL from the gitlab page described above into terminal and hit return.
Copy and paste the token from the gitlab page described above into terminal and hit return.
Enter a description for this "test" user runner and hit return.
Enter a tag unique to this particular "test" user and hit return.
Type Shell and hit return.
Verify the runner has been added and has a green dot net to it on your gitlab runners page.
Note: It is critical for this solution to set up individual runners for each of your "test" users you set up on your mac to run tests in parallel on different devices. Equally critical is that you give different tags to each of your "test" user runners so gitlab can tell each "test" user to run your UI tests.
Open terminal and type nano /Users/{test user name}/.gitlab-runner/config.toml and hit enter.
On the first line replace the number "concurrent = 1" with how ever many "test" users you created. Then hit shift+x, y, then return to save changes.
Note: Make sure it's done on each user to ensure parallelism.
Create a UI test scheme for your Xcode project.
Click the scheme dropdown menu near where you would select which device to run the project on.
Select "New Scheme".
In the "Target" dropdown menu select option that contains "UITests" in the title. Then click "OK"
Click the same scheme dropdown menu as described above and then select "Manage Schemes".
Make sure the checkbox is checked to make the "UITests" scheme "Shared".
Click close.
In terminal type git add . and hit return to ensure the schemes file is included.
Type git commit -am "Added ui test scheme" and hit return.
Type git push and hit return.
Create a gitlab-ci.yml file for your project.
Create a gitlab-ci.yml file in the root folder of your project in the text editor of your choice.
Here is an example yml file for an example project I created:
before_script:
- carthage update
stages:
- test
iphone_4s_tests:
stage: test
script:
- xcodebuild test -configuration Debug -project parallel.xcodeproj -scheme parallelUITests -destination 'platform=iOS Simulator,name=iPhone 4s' | xcpretty --simple
tags:
- iphone_4s
iphone_5s_tests:
stage: test
script:
- xcodebuild test -configuration Debug -project parallel.xcodeproj -scheme parallelUITests -destination 'platform=iOS Simulator,name=iPhone 5s' | xcpretty --simple
tags:
- iphone_5s
iphone_6_tests:
stage: test
script:
- xcodebuild test -configuration Debug -project parallel.xcodeproj -scheme parallelUITests -destination 'platform=iOS Simulator,name=iPhone 6' | xcpretty --simple
tags:
- iphone_6
IMPORTANT NOTE: Each tag should correspond with a tag on each one of the runners installed on the "test" user. The key here is that your test suite will be run on individual device
While in your project directory in terminal type git add .gitlab-ci.yml and hit enter.
Type git commit -am "Added the .gitlab-ci.yml file to the project." and then return.
Type git push and then return.
BOOM! If you've done everything correctly then your wildest dreams of testing your UI against many iOS devices in parallel has finally been realized. You'll notice that when you navigate to your gitlab project page and then the "Piplines" tab your UI tests are now running across in parallel. IMO this is the cheapest and most efficient way to get all your UI testing done. In the time it takes your test suite to complete one round on one device you can - in theory - complete the UI testing for all the devices you wish to test against. This solution is much cheaper than trying to buy several devices and having them all test at the same time. Generally speaking a single mac, depending on the specs, can run 10 - 15 devices at a time if there is nothing else taxing the CPU.
As of Xcode 9, you can now boot multiple simulators together and also can run parallel tests on multiple devices.
See the What's New in Xcode 9 Apple Documentation page for more information.
Have a look at plu/pxctest tool to execute tests in parallel ios simulators. It is much easier to integrate with project when compared to blue pill.
https://github.com/plu/pxctest
Parallel testing in now possible with the Simulator as announced in the What's New in Testing WWDC 2018 session:
Hear about exciting improvements to code coverage, including how you can build your own automation on top of Xcode's coverage reports. Learn how to dramatically speed up the execution of your tests by leveraging distributed parallel testing, new in Xcode 10.
For running UITests in parallel using multiple simulators check out this amazing open source library by LinkedIn >
https://github.com/linkedin/bluepill

How to create a Chrome profile programmatically?

Development, testing, staging environments are controlled via different proxy servers in my setup. I want to script creation of multiple Chrome profiles (sometimes called "user" or "person") and connect to a different proxy server for each of them. Finally I want to share this script with colleagues so that they have access to the exactly same setup.
The latter can be done via scripted installation of extensions such as Falcon Proxy or Proxy Helper to the Chrome profile. I would like to know how to script creation of the different profiles.
A profile is a folder inside ~/.config/google-chrome (Linux, ~/Library/Application Support/Google/Chrome (Mac OS X) and %USERPROFILE%\AppData\Local\Google\Chrome\User Data (Windows). But how to create and initialize one? Where do I register the new profile?
Creating a user
The following example applies to Windows, but the basic procedure should be the same.
First, change to the UserData folder in your Chrome installation:
cd "%APPDATA%\..\Local\Google\Chrome\User Data"
This method will copy the current user as a template for the new user. If the new user should be blank, you need to delete (CTRL + SHIFT + DEL the current browser data).
Now create a new user:
mkdir NewUser && copy Default NewUser
Change your directory to the chrome installation:
cd "C:\Program Files (x86)\Google\Chrome\Application"
Factory-Reset all user parameters:
chrome.exe --user-data-dir="..\User Data\NewUser" -first-run
where --user-data-dir is the path (full or relative) to the previously created NewUser directory.
Running as NewUser
To run chrome again using this profile, simply run chrome without the -first-run flag.
From this documentation, I finally found a way to create a user/person, rather than a separate profile. The difference is especially important in Mac OS X since different profiles can be opened concurrently using the same Chrome process.
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --profile-directory="StagingEnv" --first-run
The only unfortunate fact is that this new person doesn't inherit the name from the profile directory. Instead, it is always called Person X where X is an increment number.
I need to go to the Local State file to change it.
grep -o '"StagingEnv":{[^}]*}' ~/Library/Application\ Support/Google/Chrome/Local\ State
"StagingEnv":{"active_time":1437709453.172762,"avatar_icon":"chrome://theme/IDR_PROFILE_AVATAR_6","background_apps":false,"is_ephemeral":false,"is_omitted_from_profile_list":false,"is_using_default_avatar":true,"is_using_default_name":true,"managed_user_id":"","name":"<b>Person 3</b>","user_name":""}
This file is overridden when Chrome quits, so I need to kill Chrome, change the file and run Chrome again.
I think the easiest way to create multiple chrome profile is
On your computer, open Chrome.
At the top right, click Profile.
Click Manage people.
Click Add person.
Choose a name and a photo/picture.
Select Create a short cut on the desktop.
Click Save. A new window will open and ask you to turn on sync which is
optional.
By this, each chrome profile will be created and you can check on C:\Users\youname\AppData\Local\Google\Chrome\User Data.

PhpStorm does not sync with the server

Here's the problem :
My project on phpStorm use a remote access to the server by FTP.
When I save a modified file, the file is uploaded normally to the serv, but when I create a folder on the serv, i don't see it in phpStorm.
Any idea?
PhpStorm is built around "local project files are the main ones -- deployed are secondary" idea. It's natural to have "automatically upload to remote host" (sync local with remote) functionality to follow such an idea.
At the same time the IDE does not have anything to "automatically sync remote with local" (the reverse: to automatically copy remote stuff back to local). Simply because it contradicts such an idea: local files are the main ones.
Therefore:
The "Synchronize" button that you are referring to does not do what you are expecting it to do. It syncs what the IDE knows about project files on a local file system. In other words: it checks if there were any changes to local files done outside of the IDE. It does not do anything with remote files.
NOTE: In modern 202x.x versions it has been renamed to "Reload All from Disk" to avoid such a confusion).
To manually sync with remote files (any direction) you have these main options:
Use Remote Host side panel (can be accessed via Tools | Deployment | Browse Remote Host if it’s closed/hidden) and download any files or folders manually (drag and drop can also be used, just make sure that you are copying files because by default IDE tries to "move" (copy+delete) instead of just "copy"). It has a "Refresh" button to refresh the remote location.
Use two-way synchronisation (with preview) accessible via right click on desired folder(s)/files and choosing Deployment | Synch with Deployed... where you can sync those files/folders both ways (by default newer stuff will override older regardless of the direction).
The IDE can automatically sync one way (from local to remote): just ensure that automatic deployment is enabled and you have one server (or a group) marked as Default for this project.
Settings (Preferences on macOS) | Build, Execution, Deployment | Deployment | Options | Upload changed files automatically to the default server is the option. Check other options there to better suit your needs.
Please refer to the official help pages for more info on deployment (including a simple video tutorial): https://www.jetbrains.com/help/phpstorm/deploying-applications.html
And the funny thing about it, it is not completly correct. The option underneath is missing.. 'skip external changes' should not be ticked.
In Mac -> PHPStorm -> preferences -> Build, Execution, Deployment -> options
Set the Upload as seen in the picture to always and make sure skip external changes is unticked.
It works for me in PhpStorm 2020.1