0

Properties file cannot be reading, it returns error validation message. The method click() is undefined for the type Object

Properties obj = new Properties();
    FileInputStream objfile = new FileInputStream(System.getProperty("user.dir")+"\\application.properties");
    obj.load(objfile);

 // Navigate to link Mobile Testing and Back

    driver.findElement(By.xpath(obj.getProperty("MobileTesting"))).click();
    driver.navigate().back();

 // Enter Data into Form

    driver.findElement(By.id(obj.getProperty("EmailTextBox"))).sendKeys("test@gmail.com");
    driver.findElement(By.id(obj.getProperty("SignUpButton"))).click();
2
  • Can you paste your exception? Your code seems okay hence it might be not representative – Alexey R. Jul 6 '18 at 13:26
  • Exception is Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method click() is undefined for the type Object The method back() is undefined for the type Object The method sendKeys(String) is undefined for the type Object The method click() is undefined for the type Object at com.objectrepository.demo.DemoOR.main(DemoOR.java:33) – Som Jul 7 '18 at 9:39
0

I don't know if it will solve your problem, but I see that you have two path separators in your properties file path which may be causing an issue. I would remove them and use a more OS-agnostic solution:

FileInputStream objfile = new FileInputStream(System.getProperty("user.dir") + File.separator + "application.properties");
0

Replace the below line in your code

 driver.findElement(By.xpath(obj.getProperty("MobileTesting"))).click();

with

String b = obj.getProperty("MobileTesting");
driver.get(b); //b is the link for MobileTesting.

Let me know if you need any info otherwise in comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.