java - Selenium Webdriver, Javascript link, Unable to locale Element -


hi facing issue, below code had generated using selenium ide, trying access career portal of particular website below , jobposting qa specialist, experimenting auto complete application using selenium.

1) not able replicate code working in webdriver despite adding code under proper class , importing necessary packages. 2) on running testng test, have failure showing unable find element. 3) link qa specialist not being detected driver either if give identify by.link text or by.xpath. 4) please guide me making mistake. 5) beginer 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 inside of iframe. selenium interacts elements in current frame. element within child frame cannot interacted until switch frame. can switch 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 frame() are

  • number 0
  • id of frame
  • the webelement rerference of frame

when done in iframe, use following exit top of document:

driver.switchto().defaultcontent(); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -