Tuesday 11 June 2019

How to uninstall Java from Mac machine

Uninstalling software from Mac machine is bit tricky. It is as easy as Windows.

In this post we will know how to uninstall Java from any Mac machine. Follow the below steps to uninstall successfully from your machine

Note: We can uninstall the software as an Admin only
1. Open terminal
2. Copy and past the following commands one by one
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane  
sudo rm -fr ~/Library/Application\ Support/Oracle/Java
 
Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.

The Java Deployment cache contains files that may have been stored by Java while Java was running. It may also contain settings that were modified through the Java Control Panel.

These instructions will help you remove the Java Deployment cache, if Java has been uninstalled from the computer. The cache may still be on the computer if it was not removed during the uninstall. If Java is still installed, you may use the uninstall tool, to uninstall Java and select to remove the Java cache.

Remove Oracle Java cache on Mac 

1. Open terminal
2. Copy and past the following command
 rm -r ~/"Library/Application Support/Oracle/Java"

Source: Oracle

Friday 15 February 2019

How to use linebreak in Excel on Mac

As a regular user of Excel sometimes we need linebreak in an excel spreadsheet cell. On Windows its pretty simple and straight forward solution hit alt+enter. When it comes to Mac, its little bit tricky because there when we try the same the control will move to next cell.

To achieve this on Mac, we have to hit control+option+return keys

Hope this post will help you in addressing the issue you are facing

Sunday 5 August 2018

How to make our Mac into a WiFi Hotspot

Our Mac can function as a wireless hotspot, which allows us to connect other devices to it and share its Internet connection.
This is most useful feature by Mac if our Mac is connected to a wired network via Ethernet. We can connect any wireless devices to Mac and share the wired Internet connection with any wireless device and almost as our Mac works a wireless router.
Below are the steps to achieve this:

Enable Internet Sharing and Configure Your Hotspot

The Wi-Fi hotspot option is part of the “Internet Sharing” feature in macOS. You’ll find it in the System Preferences window. Click the Apple menu, select System Preferences, and click the Sharing icon.

Select the “Internet Sharing” option in the list. You’ll now need to select the Internet connection you want to share with the devices.
The one big limitation is that you can’t both be connected to a Wi-Fi network and host a Wi-Fi network at the same time.
For example, let’s say your Mac is connected to the Internet through an Ethernet adapter. You’d select Ethernet in the list at the top of the window and share that wired connection over Wi-Fi. If you’re connected via Bluetooth or tethered to an iPhone via a USB cable, you could also select those.
In the “To computers using” box, enable the Wi-Fi option. This will create a Wi-Fi hotspot, and the Internet connection you selected at the top of the window will be shared with devices that connect to the Wi-Fi network.
Click the “Wi-Fi Options” button at the bottom of the window to configure your Wi-Fi hotspot. Select your preferred network name and the best Wi-Fi channel.
Be sure to click the “Security” box and select “WPA2-Personal” and provide a password. By default, the hotspot will be configured without a password and anyone will be able to connect.
When you’re done setting things up, click the checkbox to the left of Internet Sharing and click Start to activate your Wi-Fi hotspot.

Monday 23 July 2018

How to Install Java in macOS

The best approach to install Java on the Mac is to get the latest version of Java JRE directly from Oracle. This is fairly straight forward and you can either initiate the process from the terminal application in macOS or by going directly to the Java download page on Oracles website.
Open the Terminal app and type the following:
java
Click on the “More Info” button to jump to the Java downloads page in a web browser
Start installing Java on MacOS
Start installing Java on MacOSThis will allow you to download and install the newest most recent version of Java available for the Mac, which is currently JRE8.

Remove Oracle Java cache on Mac

Below are the steps to clear Java cache from any Mac machine:

  1. Click on the Finder icon located in your dock
  2. Click on Go in the Finder menu
  3. Click on Utilities
  4. Double-click on the Terminal icon
  5. In the Terminal window Copy and Paste the commands below:
    rm -r ~/"Library/Application Support/Oracle/Java"

Uninstall Oracle Java using the terminal from any Mac machine

Note: To uninstall Java, you must have Administrator privileges and execute the remove command either as root or by using the sudo tool.

Remove one directory and one file (a symlink), as follows:
  1. Click on the Finder icon located in your dock
  2. Click on Go in the Finder menu
  3. Click on Utilities
  4. Double-click on the Terminal icon
  5. In the Terminal window Copy and Paste the commands below:
    sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
    sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
    sudo rm -fr ~/Library/Application\ Support/Oracle/Java
Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.

Sunday 29 October 2017

Uploading file with the help of Robot class in Selenium Automation

While implementing automation, we always come across with a situation where our code need to upload a file using our selenium code.

As we know Selenium is a Web Automation tool and which don't support windows automation. In order to upload a files, we have to perform some Windows based operations.

There are different ways to achieve this. One of the way is to take the support of Robot and StringSelection class.

Below simple code will help to perform file upload as part of Selenium Automation:

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.awt.event.KeyEvent;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class FileUpload {

public static void main(String[] args) throws InterruptedException, AWTException {

// TODO Auto-generated method stub
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://html.com/input-type-file/");

                // Absolute path of the file need to uploaded
String fileLocation = "C:\\Users\\testData.xlsx";

                // the code which helps us to perform Copy and Paste options from Clipboard
StringSelection stringSelection = new StringSelection(fileLocation);

Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);
                driver.findElement(By.id("fileupload")).click();
// CTRL+V and ENTER keys are the keyboard events to achieve the Keyboard operations
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_V);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_ENTER);

Thread.sleep(5000);
driver.quit();
}
}