Sunday, March 4, 2018

Selenium IDe : All about Selenium IDe

All about Selenium IDe


Note : You can directly use xpaths in the IDE 
example :



About :
  1. Ide is best use to perform disposable fast and small repeataitve tasks .
  2. So basically we know Java Selenium does not come with record option like other automation tools so when you can use IDe to record steps and later export to Java / Python - TestNg/ Junit . And change the element locators value to required and use it in your code.
Note : You use below links to grab your  locator values :
http://catchbug.blogspot.in/2013/11/selenium-ide-tips-and-crash-refs.html
http://catchbug.blogspot.in/2016/03/selenium-how-to-create-xpath.html
http://catchbug.blogspot.in/2015/09/selenium-using-firefox-inbuilt.html




Common Commands

Command
Number of Parameters
Description
open
0 - 2
Opens a page using a URL.
click/clickAndWait
1
Clicks on a specified element.
type/typeKeys
2
Types a sequence of characters.
verifyTitle/assertTitle
1
Compares the actual page title with an expected value.
verifyTextPresent
1
Checks if a certain text is found within the page.
verifyElementPresent
1
Checks the presence of a certain element.
verifyTable
2
Compares the contents of a table with expected values.
waitForPageToLoad
1
Pauses execution until the page is loaded completely.
waitForElementPresent
1
Pauses execution until the specified element becomes present.

Find by text value
css=tag:contains("inner text")
css=button:contains("Create Product")

Syntax for Locator Usage
Method
Target Syntax
Example
By ID
id= id_of_the_element
id=email
By Name
name=name_of_the_element
name=userName
By Name Using Filters
name=name_of_the_element filter=value_of_filter
name=tripType value=oneway
By Link Text
link=link_text
link=REGISTER
Tag and ID
css=tag#id
css=input#email
Tag and Class
css=tag.class
css=input.inputtext
Tag and Attribute
css=tag[attribute=value]
css=input[name=lastName]
Tag, Class, and Attribute
css=tag.class[attribute=value]
css=input.inputtext[tabindex=1]
DOM
>getElementById
>getElementsByName
>dom:name
(applies only to elements within a named form)
>dom:index

document.forms[index of the form].elements[index of the element]

document.getElementsByName("name")[index]
document.forms[0].elements[”phone”]



Add loop in selenium IDE :
  1. Download this js file: https://github.com/darrenderidder/sideflow/blob/master/sideflow.js
  2. Launch Selenium IDE from Firefox and open the options menu.
  3. Upload the .js file to the "Selenium Core extensions (user-extensions.js)" field.
  4. Restart IDE 
  5. Make sure u modify and add below commands depending on your requirement
New Test
Command
Target
Value
open
http://docs.seleniumhq.org/

setSpeed
1000

store
1
MyVar
while
storedVars.MyVar <= 3

echo
${MyVar}

highlight
css=img[alt="Selenium Logo"]

store
javascript{storedVars.MyVar++;}

endWhile





 Ref :
https://www.guru99.com/introduction-selenuim-ide.html

https://stackoverflow.com/questions/11033321/how-to-loop-tests-in-selenium-ide
https://www.guru99.com/first-selenium-test-script.html 


Saturday, February 24, 2018

Linux : Access Linux machine using Android

To Connect linux (debian) with Android

1. Linux - sudo apt-get install openssh-client  (remember if u want to access a system then should run client server)
2. Linux - sudo service ssh start
3. Linux -sudo service ssh status
4. Find ip address of the using - sudo ifconfig
(find ip address - usually eth0 in 1st para , for rasp pi search for something like 192.168.1.34 or something like that)
5. Now in Linux
addnew user : sudo useradd -m deepak -G sudo
add password : sudo passwd fred

6. In Android install termux app
7. Open termux  run command - apt install openssh

8. optional(https://linuxconfig.org/ssh-into-linux-your-computer-from-android-with-termux
ssh-keygen -b 4096 -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub username@192.168.1.1 )

9. ssh deepak@raspberry_ip
ex:ssh deepak"192.168.1.34

Correct way to install tar ball in Linux

Correct way to install tar ball in Linux :

Example : User installing rar application in Linux machine


method 1 :
sudo apt-get install rar
or
sudo yum install unrar

Method 2:
cd /tmp
wget https://www.rarlab.com/rar/rarlinux-5.5.0.tar.gz
tar -zxvf rarlinux-*.tar.gz
./unrar
sudo cp rar unrar /usr/local/bin

--------Clean UP-------
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get autoremove
--------------------------