Unable to click on checbox | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos
10% April Month Discount Avail now

Selenium Training Forum

Unable to click on checbox

kamal sah Post on 02/04/2019

I am using POM approach to build hybrid framework.

 

unable to click on checkbox while executing "w3schoolTest.java"

 

please find the attached file

 

D

Instructor

Demo Reply on 09/04/2019

Please refer the original approach

kamal sah Reply on 09/04/2019

means??

D

Instructor

Demo Reply on 10/04/2019

Means that, you cannot mix and match two different frameworks.

Either use POM framework or else use Hybrid Framework.

 

kamal sah Reply on 10/04/2019

I think you didn't get my point correctly...I am using POM(Page Object Model) approach.

and the issue was I am unable to click checkbox element by method contactsCheckbox.click() present inside class "ContactsPage.java" invoking by testClass "ContactsPageTest.java".
I have already attached the code. could you please just check  where I am going wrong??

Just update the config.properties with below data.

url2= https://ui.freecrm.com/

username=vijaylalsah@gmail.com

password=Lama@1234

D

Instructor

Demo Reply on 12/04/2019

Ok Somehow unable to understand the flow

Where are you going after loggin in

On which page

kamal sah Reply on 12/04/2019

After login we are landing on "HomePage"...then we are clicking on "contacts link" on leftside panel. which will open contacts page.

On contacts page there is a checkbox assoiated with a value "rohan singh samla". which I want to select....

Please let me know if you need more info.

D

Instructor

Demo 1 days go

Finally , I had to use actions class and its resolved. This is working

WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://ui.freecrm.com");
driver.findElement(By.name("email")).sendKeys("vijaylalsah@gmail.com");
driver.findElement(By.name("password")).sendKeys("Lama@1234");
driver.findElement(By.name("password")).sendKeys(Keys.ENTER);
WebDriverWait wait = new WebDriverWait(driver, 20);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//*[@id='main-nav']/a[3]/span")));
driver.findElement(By.xpath("//*[@id='main-nav']/a[3]/span")).click();;
//driver.findElement(By.xpath("//*[@id='ui']/div/div[2]/div[2]/div/div[2]/table/tbody/tr[4]/td[1]/div/input")).click();
int s = driver.findElements(By.cssSelector("div.ui.fitted.read-only.checkbox input")).size();
System.out.println(s);
//driver.findElements(By.cssSelector("div.ui.fitted.read-only.checkbox input")).get(2).click();
Actions act = new Actions(driver);
act.click(driver.findElements(By.cssSelector("div.ui.fitted.read-only.checkbox input")).get(2)).build().perform();;

kamal sah 0 days go

Thanks...