I am using selenium. I want to scrape out the multiple text from a website. like monster job list or jobstrret .How to do this using selenium?

0 votes

Please help me to write script for this i already run this but i am getting this output one only otherwise i am getting keep on same value in the console tab but i want multiple data at time

public class Monster1 {

public static void main(String[] args) throws InterruptedException {

System.setProperty("webdriver.chrome.driver", "C:\\softwares\\selenium\\webdrivers\\chromedriver.exe");

WebDriver driver=new ChromeDriver();

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

driver.manage().window().maximize();

Thread.sleep(2000);

driver.findElement(By.xpath("//input[@class='input search-bar home_ac']")).click();

WebElement search=driver .findElement(By.xpath("//input[@class='input search-bar home_ac']"));

search.sendKeys("Software Testers");

search.sendKeys(Keys.ARROW_DOWN);

search.sendKeys(Keys.ENTER);

Thread.sleep(2000);

//parent List

//WebElement parentList=driver.findElement(By.xpath("//*[@id=\"srp-right-part\"]/div/div[1]/div[1]/div[2]"));

WebElement parentList=driver.findElement(By.xpath("//div[@id=\"srp-right-part\"]/div/div[1]/div[1]/div[2]"));

List<WebElement> childList= parentList.findElements(By.xpath("//*"));

System.out.println(childList.size());

for(int i=0;i<childList.size();i++) {

System.out.println("________________________________________________________________________");

WebElement row = childList.get(i);

WebElement jobtitle = row.findElement(By.xpath("//div[@class='job-tittle']"));

String jTitle= jobtitle.getText();

System.out.println(jTitle);
Sep 7 in Selenium by anonymous

edited Sep 9 by Omkar 91 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Selenium

0 votes
1 answer

How to get the text from a website using selenium?

hey, you can use get.text() method to ...READ MORE

answered Dec 31, 2018 in Selenium by Sudhanshu
1,964 views
0 votes
1 answer
0 votes
1 answer

How can I clear the text in a text box using Selenium WebDriver?

Hello Akriti, you can clear the text ...READ MORE

answered May 29 in Selenium by Anvi
• 13,960 points
311 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,110 points
993 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
1,145 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
889 views