This is the error I am getting
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <input tabindex="1" class="za-tos" id="tos" name="tos" value="false" onclick="toggleTosField()" type="checkbox"> is not clickable at point (381, 403). Other element would receive the click: <div class="signup-form">...</div>
(Session info: chrome=85.0.4183.102)
Source code of Zoho
package WebElementfunctions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.Test;
import base.TestBase;
public class Zoho extends TestBase{
@Test
public void appTest() throws InterruptedException {
WebDriver driver=launchBrowser("chrome");
driver.get("https://www.zoho.com/signup.html");
//boolean b=driver.findElement(By.xpath("//input[@id='tos']")).isEnabled();
boolean b=driver.findElement(By.cssSelector("input#tos")).isEnabled();
System.out.println(b);
//Explicit WebDriver
int i=0;
while(i<=10) {
if (driver.findElement(By.cssSelector("input#tos")).isEnabled())
break ;
else {
Thread.sleep(1000);
i++;
}
}
b=driver.findElement(By.cssSelector("input#tos")).isEnabled();
System.out.println(b);
driver.findElement(By.cssSelector("input#tos")).click();
//driver.findElement(By.xpath("//input[@id='tos']")).click();
driver.findElement(By.xpath("//input[@name='email']")).sendKeys("hello@gmail.com");
String text=driver.findElement(By.xpath("//input[@name='email']")).getAttribute("value");
System.out.println("Text entered in email field "+text);
//driver.findElement(By.xpath("//input[@id='tos']")).click()
// driver.findElement(By.cssSelector("span#signup-termservice")).click();*/
}
}
/***********TestBase Source Code************/
package base;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.PageLoadStrategy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeDriverService;
import org.openqa.selenium.edge.EdgeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.ProfilesIni;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerDriverService;
import org.testng.annotations.Test;
public class TestBase {
WebDriver driver;
@Test
public WebDriver launchBrowser(String browser) {
if(browser.equals("mozilla")) {
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "logs\\firefox.log");
FirefoxOptions options=new FirefoxOptions();
ProfilesIni prof=new ProfilesIni();
FirefoxProfile fireprof=new FirefoxProfile();
//manage webnotification
fireprof.setPreference("dom.webnotifications.enabled", false);
//manage ssl
//fireprof.setAcceptUntrustedCertificates(true);
//fireprof.setAssumeUntrustedCertificateIssuer(false);
// proxy setting
//fireprof.setPreference("network.proxy.type", 1);
//fireprof.setPreference("network.proxy.socks", "83.44.39.12");
//fireprof.setPreference("network.proxy.socks_port", 1823);
options.setPageLoadStrategy(PageLoadStrategy.EAGER);
options.setProfile(fireprof);
driver=new FirefoxDriver(options);
}
if(browser.equals("chrome")) {
System.setProperty(ChromeDriverService.CHROME_DRIVER_LOG_PROPERTY, "logs\\chrome.log");
System.setProperty(ChromeDriverService.CHROME_DRIVER_SILENT_OUTPUT_PROPERTY, "true");
ChromeOptions opt=new ChromeOptions();
opt.addArguments("--disable-notification");
opt.addArguments("--start-maximized");
opt.setCapability("pageLoadStrategy", "normal");
driver=new ChromeDriver(opt);
}
if(browser.equals("ie")) {
System.setProperty(InternetExplorerDriverService.IE_DRIVER_LOGLEVEL_PROPERTY, "INFO");
System.setProperty(InternetExplorerDriverService.IE_DRIVER_LOGFILE_PROPERTY, "logs\\ie.log");
driver=new InternetExplorerDriver(); }
if(browser.equals("edge")) {
System.setProperty(EdgeDriverService.EDGE_DRIVER_LOG_PROPERTY,"logs\\edge.log");
System.setProperty(EdgeDriverService.EDGE_DRIVER_SILENT_OUTPUT_PROPERTY,"true");
System.setProperty("webdriver.edge.driver", "C:\\Tools\\TestingTools\\drivers\\msedgedriver.exe");
EdgeOptions options = new EdgeOptions();
//options.setBinary(new File(""));
options.addArguments("--disable-notifications");
options.addArguments("--start-maximized");
//options.addArguments("--proxy-server=http://83.209.94.87:8123");
options.setPageLoadStrategy(PageLoadStrategy.EAGER);
options.addArguments("ignore-certificate-errors");
// NOTIFICATIONS and PROFILE
driver = new EdgeDriver(options);// make sure previous session is
}
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().window().maximize();
return driver;
}
}
Instructor
Ashish Thakur Replied on 15/09/2020
Please make sure the element you are trying to interact is visible on the screen.