Monday, October 29, 2012

Install windows from bootable USB DRIVE/Pendrive


Hello friends,

Most of the time my friends asks me to help them install windows to their system via USB pen drive. So today I am going to write down the steps to make win7/vista bootable pen drive.

To make a bootable pendrive . You should have –
 Atleast 4 to 8 Gb pendrive.
 Windows 8/7/vista DVD or Windows 8/7/DVD image 




So once you have it.
10 Steps to make your pen drive boot-able :.
1.       Plugin your pendrive to your PC or laptop.
2.       Go to ‘My Computer’ and format the pen drive.
3.       Now open command prompt with Administrator priviledges.
(Go to Start > All programs > Accessories > command prompt , right click on command prompt and run it as an administrator.)
4.       When command prompt opens,enter the following command in series as written below
a.       DISKPART   ,  and press enter.

b.      LIST DISK  , press enter.
     
Once 'LIST DISK' command is completed. From the results remember the disk name of your pen drive. As in my case my USB name is “Disk 2”. So we will be using ‘Disk 2 ’ in our example.
Now, execute the following command one by one.


SELECT DISK 2
CLEAN
CREATE PARTITION PRIMARY
SELECT PARTITION 1
ACTIVE
FORMAT FS = NTFS
ASSIGN
EXIT


Now,don’t close the command prompt.
5.       Put your windows disk in you CD ROM (if your system CD ROM is  not working then you can use windows image file and mount it to virtual CD ROM).Now suppose your windows CD ROM drive is  “E:”.
6.       Then go to command prompt and execute following command.

E:
E:\> CD BOOT. Press enter  (Here ‘E:’ is your windows 7/vista disk drive name)
E:\BOOT> BOOTSECT.EXE /NT60 D:  (Here ‘D:’ is your USB disk drive name).

7.       Once above commands is executed. close the command prompt.
8.       Select all the files from your windows 8/7/Vista disk and copy them to your USB drive.Now USB is ready to boot windows.
9.       Now restart windows and boot from USB.(You can change boot priority in BIOS)
10.   Windows installation will start as normally like windows disk.(Enjoy : ))

If you find any problem ,then feel free to ask question and leave your comments…

Friday, October 26, 2012

How to locate element in Html 'svg' tag in Selenium 2(Webdriver)


Sample svg code enbeded into Html code
 <html>  
 <head>  
 <title>automatethebox.blogspot.com</title>  
 </head>  
 <body>  
 <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="939" height="360">  
 <defs>  
 <g zIndex="10">  
 <tspan x="5.5">You</tspan>  
 </g>  
 <g zIndex="20">  
 <tspan x="5.5">Me</tspan>  
 </g>  
 <g zIndex="30">  
 <tspan x="5.5">None</tspan>  
 </g>  
 </svg>  
 </body>  
 </html>  
Selenium 2 (Webdriver) code to locate and intract with an svg element embeded into HTML 
Suppose in above given svg code three buttons are embeded into the svg.
Now we will be finding the button and be clicking on them using 'css locators'.Here we go....

Method 1
 // First of all find the 'svg' tag in the page and save it into as WebElement instance.  
 WebElement svgElement = driver.findElement(By.cssSelector("svg"));  
   
 // Get the Buttons with which we want to interact in a list  
 List<WebElement> gElements = svgElement.findElements(By.cssSelector("g"));  
   
 // Click on 'Me' Button  
 WebElement button = gElements.get(0).findElement(By.cssSelector("tspan");  
 button.click();  
   
 // Click on 'You' Button  
 WebElement button = gElements.get(1).findElement(By.cssSelector("tspan");  
 button.click();  
   
 // Click on 'None' Button  
 WebElement button = gElements.get(2).findElement(By.cssSelector("tspan");  
 button.click();  
Method 2
 // Locate buttons and save in the WebElement instances.  
 WebElement meButton = driver.findElement(By.cssSelector("//*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']//*[local-name()='tspan' and text()='Me']"));  
 WebElement youButton = driver.findElement(By.cssSelector("//*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']//*[local-name()='tspan' and text()='You']"));  
 WebElement noneButton = driver.findElement(By.cssSelector("//*[local-name()='svg' and namespace-uri()='http://www.w3.org/2000/svg']//*[local-name()='tspan' and text()='None']"));  
   
 // Click on the buttons.  
 meButton.click();  
 youButton.click();  
 noneButton.click();  

Wednesday, October 24, 2012

How to switch between browser windows in Selenium 2 (WebDriver Java)

 // Store you current window handle in a String variable.  
 String parentWindow = driver.getWindowHandle();  
   
 // Click on the the page element which causes a new window to be opened,suppose a link.  
 driver.findElement(BY.linkText("myLink")).click();  
   
 // Get the window handle of the new browser window opened.  
 String childWindow = (String) driver.getWindowHandles().toArray()[1];  
   
 // Switch to newly opened window.  
 driver.switchTo().window(childWindow);  
   
 // Switch back to main window.  
 driver.switchTo().window(parentWindow);  


© automatethebox. All Rights Reserved

Monday, October 22, 2012

How Google reCaptcha works.


Capcha stands for 'Completely Automated Public Turing test to tell Computers and Humans Apart'


Google reCaptcha usually contains two ciphered words as shown in above image.
Among the two words one word is 'Control word' while other is 'Unknown word' i.e. 'Control word' is the word for which reCaptcha software knows the correct result where for the 'unknown word' Google reCaptcha software itself don't know the exact result.

Q :  So, the question is if i write a invalid word in place of 'unknown word' in the reCapcha response will it pass.
A  : Yes, it will pass as Google itself does not know the correct result  :)

For example :
If  two words are displayed as a challenge, then the word which seems more difficult to be readable by humans and OCR  is the 'Unknown word.' (In above picture "ynnonp" looks like the unknown word.)
So if you type the first word(ynnonp) incorrectly and second word (execellent) correctly, you will be authenticated successfully.

To get more info about 'Control word' and 'Unknown word' and what is the story behind this go to "http://www.google.com/recaptcha/learnmore".


© automatethebox. All Rights Reserved

Friday, October 19, 2012

Stop the Jmeter process from windows command line


Hi,

Today i got into a problem when i wanted to stop/kill Jmeter process from command line.
But as Jmeter runs as a java.exe process, so we cant just kill the java processes to stop the Jmeter.
So i tried just a little hack to kill only the Jmeter process and it worked... :)


You can try the following command in windows command promt for this.

Execute the following command on windows command line one by one ================================================================

1:  FOR /F "tokens=*" %%G IN ('netstat -o ^| find /C "8085"') DO SET JCOUNT=%%G  
2:  SET /a JCOUNT-=1  
3:  FOR /F "tokens=5 skip=%JCOUNT%" %%G IN ('netstat -o ^| findstr 8085') DO taskkill /F /PID %%G  

Or you can put all the above files in a batch file and execute that.

In the above command replace the port '8085' with the port number you are using for Jmeter to start on.

Cheers!!!


© automatethebox. All Rights Reserved

AWS Certified Solutions Architect Associate - AWS Introduction - Questions

All the Best !!! Show Result !! Try Again !! ×