How can I search for a video on YouTube?

0 votes
Can someone explain me the way to search a video on Youtube?
Dec 19, 2018 in Selenium by Jino
• 5,570 points
348 views

1 answer to this question.

0 votes

I will tell you step by step as how to do this, please follow the steps and you are good to go.

1. set the path of your chrome/ firefox driver you are going to use.

System.setProperty("webdriver.chrome.driver","C:\\Your\\Path\\chromedriver.exe");
WebDriver driver = new ChromeDriver();

2. Open the youtube webpage 

driver.get("https://www.youtube.com");

3. Get the id for the search box and type the keyword.

driver.findElement(By.id("search")).sendKeys("Happiness");

4. Click on the search key.

driver.findElement(By.id("search-icon-legacy")).click();

Hope this helps!

answered Dec 19, 2018 by Nabrupa

Related Questions In Selenium

0 votes
1 answer
0 votes
0 answers

How to write a code for combo box and how can i select a country from country dropdown?

Hi, I want to select a country from ...READ MORE

Mar 14 in Selenium by ch Praveen
382 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,430 points
1,196 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,510 points
1,281 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,510 points
1,038 views
0 votes
1 answer