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,520 points
80 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
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
345 views
0 votes
1 answer
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,050 points
142 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,130 points
531 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,130 points
134 views
+2 votes
1 answer
0 votes
1 answer

How can I take a screenshot using selenium?

Hello @Sradha, You can use the File ...READ MORE

answered Dec 31, 2018 in Selenium by Nabarupa
40 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.