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, 2019 in Selenium by anonymous

edited Sep 9, 2019 by Omkar 686 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
2 answers

How to get the text from a website using selenium?

driver.findElement(By.cssSelector("p")).getText() or  IWebElement element = Browser.GetElementByCssSelector("div.loginbox p"); string text = ...READ MORE

answered Sep 5 in Selenium by Sri
• 2,970 points
11,211 views
0 votes
1 answer
0 votes
1 answer

How to extract text from a web page using selenium and save it as a text file?

Hello Isha, you can checkout this code ...READ MORE

answered May 7, 2019 in Selenium by Anvi
• 14,110 points
20,785 views
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, 2019 in Selenium by Anvi
• 14,110 points
1,216 views
0 votes
2 answers

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,520 points
3,790 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31 in Selenium by Sri
• 2,970 points
4,771 views
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,749 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 2 in Selenium by Sri
• 2,970 points
3,113 views