SlideShare une entreprise Scribd logo
1  sur  5
Selenium Webdriver Scripts
http://funandknowledge.blogspot.in/

For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
Selenium Webdriver Scripts
1. get( ) - Selenium WebDriver method to open the specified
URL page
public class Sample {
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("http://www.funandknowledge.blogspot.com");
}
}
Opens google page
2.getTitle() - Returns The title of the current page
public class Sample {
{

public static void main(String[] args)
WebDriver driver = new FirefoxDriver();

driver.get("http://www.funandknowledge.blogspot.com");
System.out.println(driver.getTitle());
}
}
Output- QTP Scripts and Selenium Webdriver Scripts
For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
3. getCurrentUrl() - Returns The URL of the page currently
loaded in the browser
public class Sample {
{

public static void main(String[] args)
WebDriver driver = new FirefoxDriver();

driver.get("http://www.funandknowledge.blogspot.com");
System.out.println(driver.getCurrentUrl());
}
}

Output - http://www.funandknowledge.blogspot.in/
4. getPageSource() - Returns the source code of the page
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
System.out.println(driver.getPageSource());
}
}

For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
5. close() - Closes the current window

public class Sample {
{

public static void main(String[] args)
WebDriver driver = new FirefoxDriver();

driver.get("http://www.funandknowledge.blogspot.com");
driver.close();
}
}

6.How to Maximize browser window in Selenium Web Driver
public class Sample {
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("http://www.funandknowledge.blogspot.com");
driver.manage().window().maximize();
}
}

For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
7. How to get label text or capture label text in Selenium
webdriver

public class Sample {
public static void main(String[] args)
{
WebDriver driver = new FirefoxDriver();
driver.get("http://google.com");
System.out.println(driver.findElement(By.name("btnK")).g
etText());

}

}

Output- Google Search

For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/

Contenu connexe

En vedette

ASLLY抗藍光眼鏡型錄
ASLLY抗藍光眼鏡型錄ASLLY抗藍光眼鏡型錄
ASLLY抗藍光眼鏡型錄
Kenn Ma
 
服貿黑箱「之前」發生的事 我們真的被煽動了嗎
服貿黑箱「之前」發生的事 我們真的被煽動了嗎 服貿黑箱「之前」發生的事 我們真的被煽動了嗎
服貿黑箱「之前」發生的事 我們真的被煽動了嗎
Kenn Ma
 
Pasal 27 ayat 2 uu ite
Pasal 27 ayat 2 uu itePasal 27 ayat 2 uu ite
Pasal 27 ayat 2 uu ite
Lucky Lucky
 

En vedette (15)

The Promise of 1:1 Learning
The Promise of 1:1 Learning The Promise of 1:1 Learning
The Promise of 1:1 Learning
 
ASLLY抗藍光眼鏡型錄
ASLLY抗藍光眼鏡型錄ASLLY抗藍光眼鏡型錄
ASLLY抗藍光眼鏡型錄
 
服貿黑箱「之前」發生的事 我們真的被煽動了嗎
服貿黑箱「之前」發生的事 我們真的被煽動了嗎 服貿黑箱「之前」發生的事 我們真的被煽動了嗎
服貿黑箱「之前」發生的事 我們真的被煽動了嗎
 
Pasal 27 ayat 2 uu ite
Pasal 27 ayat 2 uu itePasal 27 ayat 2 uu ite
Pasal 27 ayat 2 uu ite
 
De hobbit
De hobbitDe hobbit
De hobbit
 
Portfolio Fight chrono
Portfolio Fight chronoPortfolio Fight chrono
Portfolio Fight chrono
 
CCSS Assessments Erasing_Uncertainty_9.12.13
CCSS Assessments Erasing_Uncertainty_9.12.13CCSS Assessments Erasing_Uncertainty_9.12.13
CCSS Assessments Erasing_Uncertainty_9.12.13
 
別途資料
別途資料別途資料
別途資料
 
14 augustus 1992
14 augustus 199214 augustus 1992
14 augustus 1992
 
Sivilsa
SivilsaSivilsa
Sivilsa
 
Actualizaciones en SDRA Pediátrico
Actualizaciones en SDRA PediátricoActualizaciones en SDRA Pediátrico
Actualizaciones en SDRA Pediátrico
 
Esgrima maestro
Esgrima maestroEsgrima maestro
Esgrima maestro
 
MARS ORBITER MISSION (MOM) (MANGALYAN)
MARS ORBITER MISSION (MOM) (MANGALYAN)MARS ORBITER MISSION (MOM) (MANGALYAN)
MARS ORBITER MISSION (MOM) (MANGALYAN)
 
Wind power in india
Wind power in indiaWind power in india
Wind power in india
 
Z ve T Puanları
Z ve T PuanlarıZ ve T Puanları
Z ve T Puanları
 

Similaire à Selinium webdriver scripts - http://funandknowledge.blogspot.in/

Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Rashedul Islam
 
Create an advance data type to represent web page history. Name this .pdf
Create an advance data type to represent web page history. Name this .pdfCreate an advance data type to represent web page history. Name this .pdf
Create an advance data type to represent web page history. Name this .pdf
sanuoptical
 

Similaire à Selinium webdriver scripts - http://funandknowledge.blogspot.in/ (20)

Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-JupiterToolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
 
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
Step 8_7_ 6_5_4_3_2_ 1 in one_Tutorial for Begineer on Selenium Web Driver-Te...
 
Webdriver with Thucydides - TdT@Cluj #18
Webdriver with Thucydides - TdT@Cluj #18Webdriver with Thucydides - TdT@Cluj #18
Webdriver with Thucydides - TdT@Cluj #18
 
Selenium for Tester.pdf
Selenium for Tester.pdfSelenium for Tester.pdf
Selenium for Tester.pdf
 
Component Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with SeleniumComponent Based Unit Testing ADF with Selenium
Component Based Unit Testing ADF with Selenium
 
Automated Testing ADF with Selenium
Automated Testing ADF with SeleniumAutomated Testing ADF with Selenium
Automated Testing ADF with Selenium
 
WebDriverManager: the Swiss Army Knife for Selenium WebDriver
WebDriverManager: the Swiss Army Knife for Selenium WebDriverWebDriverManager: the Swiss Army Knife for Selenium WebDriver
WebDriverManager: the Swiss Army Knife for Selenium WebDriver
 
Breaking the limits_of_page_objects
Breaking the limits_of_page_objectsBreaking the limits_of_page_objects
Breaking the limits_of_page_objects
 
Selenium training
Selenium trainingSelenium training
Selenium training
 
Get Started With Selenium 3 and Selenium 3 Grid
Get Started With Selenium 3 and Selenium 3 GridGet Started With Selenium 3 and Selenium 3 Grid
Get Started With Selenium 3 and Selenium 3 Grid
 
Create an advance data type to represent web page history. Name this .pdf
Create an advance data type to represent web page history. Name this .pdfCreate an advance data type to represent web page history. Name this .pdf
Create an advance data type to represent web page history. Name this .pdf
 
Selenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver TutorialSelenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver Tutorial
 
Getting up and running with selenium for automated Code palousa
Getting up and running with selenium for automated  Code palousaGetting up and running with selenium for automated  Code palousa
Getting up and running with selenium for automated Code palousa
 
Selenium
SeleniumSelenium
Selenium
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
[@IndeedEng] Building Indeed Resume Search
[@IndeedEng] Building Indeed Resume Search[@IndeedEng] Building Indeed Resume Search
[@IndeedEng] Building Indeed Resume Search
 
FluentLeniumで困った話
FluentLeniumで困った話FluentLeniumで困った話
FluentLeniumで困った話
 
Test automation
Test  automationTest  automation
Test automation
 
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
Selenium & PHPUnit made easy with Steward (Berlin, April 2017)
 

Dernier

Dernier (20)

ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 

Selinium webdriver scripts - http://funandknowledge.blogspot.in/

  • 1. Selenium Webdriver Scripts http://funandknowledge.blogspot.in/ For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
  • 2. Selenium Webdriver Scripts 1. get( ) - Selenium WebDriver method to open the specified URL page public class Sample { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://www.funandknowledge.blogspot.com"); } } Opens google page 2.getTitle() - Returns The title of the current page public class Sample { { public static void main(String[] args) WebDriver driver = new FirefoxDriver(); driver.get("http://www.funandknowledge.blogspot.com"); System.out.println(driver.getTitle()); } } Output- QTP Scripts and Selenium Webdriver Scripts For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
  • 3. 3. getCurrentUrl() - Returns The URL of the page currently loaded in the browser public class Sample { { public static void main(String[] args) WebDriver driver = new FirefoxDriver(); driver.get("http://www.funandknowledge.blogspot.com"); System.out.println(driver.getCurrentUrl()); } } Output - http://www.funandknowledge.blogspot.in/ 4. getPageSource() - Returns the source code of the page public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://www.google.com"); System.out.println(driver.getPageSource()); } } For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
  • 4. 5. close() - Closes the current window public class Sample { { public static void main(String[] args) WebDriver driver = new FirefoxDriver(); driver.get("http://www.funandknowledge.blogspot.com"); driver.close(); } } 6.How to Maximize browser window in Selenium Web Driver public class Sample { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://www.funandknowledge.blogspot.com"); driver.manage().window().maximize(); } } For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/
  • 5. 7. How to get label text or capture label text in Selenium webdriver public class Sample { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://google.com"); System.out.println(driver.findElement(By.name("btnK")).g etText()); } } Output- Google Search For more Selenium Webdriver Scripts Visit - http://funandknowledge.blogspot.in/