Monday, March 24, 2025

The best way to add row components in selenium?


I wish to add right this moment’s rely. I’m new to selenium, and am not getting the way 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 Type {                


    public static void primary(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.measurement());

        //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.measurement());
    }
}

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles