Showing posts with label selenium. Show all posts
Showing posts with label selenium. Show all posts

Saturday, February 16, 2019

[INTERVIEW] Selenium basic to advance level Questions - Part 1

Below are the Selenium Webdriver question I faced during my Interview with several companies -

Q1. What is Synchronization in selenium?
Click to view Answer

Q2. What is the difference between Thread.Sleep and selenium.setSpeed?
Click to view Answer

Q3. How to perform a double click on an element or any context menu?
Click to view Answer

Q4. How to use Maven for server repository?
Help me in solving this question

Q5. How to use AutoIt for file upload wit a relative path?
Help me in solving this question

Q6. How to get all elements of the combo box?
Click to view Answer

Q7. How to select 2 or 3 elements of the combo box?
Click to view Answer

Q8. Select any link through java scripts
Click to view Answer

Q9. How to get Y axis of elements?
Click to view Answer

Q10. How to work with security certificate in selenium?
Click to view Answer

Q11. How to switch windows in selenium?
Click to view Answer

Q12. What are different annotations in TestNG?
Click to view Answer

Q13. Is WebDriver is interface or class?
Click to view Answer

Q14. What is Context Menu operation and how it is performed?
Click to view Answer

Saturday, January 28, 2017

[TIPS] Selenium Implicit Wait - Turn ON and OFF

While automating web application Selenium Webdriver Implicit wait is applied to all findElement and findElements keyword till the element is visible. But in some case we need to check if fields visibility immediately on performing some actions. So why to wait for default implicit wait of 15 or 30 seconds.

Here is the simple tip to override Implicit default wait time by Turning OFF the implicit wait while performing action and validating field visibility. Below Java code snippet will be helpful -

 public void turnOFFImplicitWait(Webdriver driver)  {  
   driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS);  
 }  

After verifying the step turn ON default implicit wait as below -
 public void turnONImplicitWait(Webdriver driver)  {  
   driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);  
 }  

Thursday, March 17, 2016

Demo Practice website for Selenium Automation Testing

Here are some demo sites for learning Selenium Automation Testing using Selenium IDE or Selenium RC (Selenium Remote control) or Selenium Webdriver.

E-commerce website - http://store.demoqa.com/
Basic fields demo portal - http://demoqa.com/
Automation demo web page practice - http://toolsqa.com/automation-practice-form/
Switch window - http://toolsqa.com/automation-practice-switch-windows/
Handling browsers alerts - http://toolsqa.com/handling-alerts-using-selenium-webdriver/
iFrame practice - http://toolsqa.com/iframe-practice-page/

Tuesday, January 26, 2016

Find text in table without table iteration

Normally we follow the approach of iterating table, find the required text and perform some operation on same row. This approach is fast for small table but when it comes to very large table iteration will be slow enough.

Instead without iterating the table find the text using xpath and perform operation on same row.

Let take an example:









From above table we want 'Travel' time (column = 7) of particular train from 'Train No' (column=1).

String travelTime = driver.findElement(
By.xpath("//table[@id='trainInfo']/tbody/tr/td[text()='19215']/../td[7]")).getText();

OUTPUT:
Travel time: 15.35

Tuesday, January 19, 2016

[ERROR]How to resolve "Multiple annotations found at this line" in pom.xml file?

Today while creating new project I came across below error message in POM.xml file after deleting Junit dependencies and including TestNG dependencies and worried how to solve. Luckily I found solution from my preview project.

Multiple annotations found at this line:
- ArtifactTransferException: Failure to transfer org.apache.httpcomponents:httpclient:jar:
4.5.1 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution 
will not be reattempted until the update interval of central has elapsed or updates are forced. 
Original error: Could not transfer artifact org.apache.httpcomponents:httpclient:jar:4.5.1 from/to 
central (http://repo.maven.apache.org/maven2): connection timed out to http://
repo.maven.apache.org/maven2/org/apache/httpcomponents/httpclient/4.5.1/httpclient-4.5.1.jar
- ArtifactTransferException: Failure to transfer org.apache.httpcomponents:httpcore:jar:
4.4.3 from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution 
will not be reattempted until the update interval of central has elapsed or updates are forced. 
Original error: Could not transfer artifact org.apache.httpcomponents:httpcore:jar:4.4.3 from/to 
central (http://repo.maven.apache.org/maven2): connection timed out to http://
repo.maven.apache.org/maven2/org/apache/httpcomponents/httpcore/4.4.3/httpcore-4.4.3.jar
- ArtifactTransferException: Failure to transfer commons-logging:commons-logging:jar:1.2 
from http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not 
be reattempted until the update interval of central has elapsed or updates are forced. Original 
error: Could not transfer artifact commons-logging:commons-logging:jar:1.2 from/to central (http://
repo.maven.apache.org/maven2): connection timed out to http://repo.maven.apache.org/
maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.jar

SOLUTION:
Just include below "httpclient" dependencies solved my problem.
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.4</version>
</dependency>

Read CSV from S3

 import csv def count_records(csv_file):     record_count = 0     first_line = None     last_line = None     # Open the CSV file and read it...