I am trying to find an element By.cssSelector("#e1")
. On this website : SALESFOCE.COM.
I am trying to find an element on this first button(image below), which is a <div>
.
From java, I tried By.xPath and By.cssSelector but every time I am getting No such element exception. I also used Implicit and explicit wait still getting same exception.
But if I find using inspect element than it highlights the element.
The element Salesforce
is under iframe
you need to switch to iframe
first in order to access the element.
Use WebdriverWait()
and wait for frameToBeAvailableAndSwitchToIt()
and use following locator to identify.
Use WebdriverWait()
and wait for elementToBeClickable()
and use following locator to identify.
driver.get("http://ww1.salesfoce.com/")
new WebDriverWait(driver, Duration.ofSeconds(10)).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.cssSelector("#rs>iframe")));
new WebDriverWait(driver, Duration.ofSeconds(10)).until(ExpectedConditions.elementToBeClickable(By.xpath("//span[text()='Salesforce']"))).click();