Hi I am facing this issue, Below is a code which i had generated using Selenium IDE, Basically i am trying to access a career portal of the particular website below and for the Jobposting QA specialist, I was experimenting to auto complete the application using Selenium.
1) I am not able to replicate the code working in webdriver despite adding the code under proper class and importing all the necessary packages. 2) On running it as a TestNG test, i have a failure showing Unable to find Element. 3) The link to the QA specialist is not being detected by the driver either if i give it as identify By.link text or By.xpath. 4) please guide me where i am making mistake. 5) I am a beginer to Selenium
public class Application {
private WebDriver driver;
private String baseUrl;
private boolean acceptNextAlert = true;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
driver = new FirefoxDriver();
baseUrl = "http://www.saymedia.com/";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@Test
public void testApplication() throws Exception {
driver.get(baseUrl + "/jobs");
driver.findElement(By.linkText("QA Specialist")).click();
driver.findElement(By.linkText("Apply Now")).click();
driver.findElement(By.linkText("Send Application")).click();
}
Your elements are inside of an iframe
. Selenium only interacts with elements in the current frame. Any element within a child frame
cannot be interacted with until you switch into that frame
. You can switch by using switchTo().frame()
:
driver.get(baseUrl + "/jobs");
driver.switchTo().frame("jobviteframe");
driver.findElement(By.linkText("QA Specialist")).click();
driver.findElement(By.linkText("Apply Now")).click();
driver.findElement(By.linkText("Send Application")).click();
The arguments for frame()
are
frame
webelement
rerference of the frame
When done in the iframe
, use the following to exit back to the top of the document:
driver.switchTo().defaultContent();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.