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,670 points
1,472 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
not working,navigating till opening youtube
Are you getting any error in the process?

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer

How do I play a thumbnail video for a particular product eg. mobile on flipkart site?

Automating video streaming is a bit challenging ...READ MORE

answered 6 days ago in Selenium by Sirajul
• 55,300 points
56 views
+1 vote
1 answer
0 votes
1 answer

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

https://stackoverflow.com/questions/40017443/how-to-perform-dropdow ...READ MORE

answered May 8 in Selenium by vaibhav
475 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,510 points
3,085 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,890 points
2,344 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,890 points
2,489 views
–1 vote
1 answer