Wednesday, April 30, 2025

Tips on how to add row components in selenium?


I need to add at this time’s depend. I’m new to selenium, and am not getting tips on how to add utilizing selenium. Can anybody counsel an answer?

That is my code:

package deal testpk;

import org.openqa.selenium.By;        
import org.openqa.selenium.WebDriver;        
import org.openqa.selenium.firefox.FirefoxDriver;

import java.awt.Listing;

import org.openqa.selenium.*;

public class Kind {                


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

        // declaration and instantiation of objects/variables        

        WebDriver driver = new FirefoxDriver();

        driver.handle().window().maximize();
        driver.get("http://beta-app.1bridge.in/#/auth/login"); 
        Thread.sleep(6000);

        driver.findElement(By.xpath("//enter[@type="text"]")).sendKeys("RB0764",Keys.ENTER);
        Thread.sleep(3000);
        driver.findElement(By.xpath("//enter[@type="password"]")).sendKeys("kanna123",Keys.ENTER);

        Thread.sleep(7000);
        driver.findElement(By.xpath("//*[@data-id='dashboard']")).click on();
        Thread.sleep(5000);
        WebElement desk = driver.findElement(By.xpath("//*[@id="pcoded"]/div[2]/div/div/div/div/div/div/app-default/div/app-modal-basic/div/div/div/div/div/div/desk/tbody/tr[1]/td[1]/p"));

        Listing listOfRows = (Listing) desk.findElements(By.tagName("tr"));

        System.out.println("Rows: "+listOfRows.dimension());

        //Listing<WebElement> listOfCols = listOfRows.get(0).findElements(By.tagName("td")); //If first row is regular row

        Listing<WebElement> listOfCols = ((WebDriver) listOfRows).get(0).findElements(By.tagName("th")); //If first row is header row

        System.out.println("Columns: "+listOfCols.dimension());
    }
}

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles

PHP Code Snippets Powered By : XYZScripts.com