dimanche 8 octobre 2017

Selenium-Java(with Eclipse) : Trying to 'Continue' in PayPal sandbox

I am trying to make a test on a magento e-shop.

To be more specific I want to test if PayPal (payment method) works fine. So I did everything well until the last step.

i will write down the code so you can all see what I did.

driver.switchTo().frame(driver.findElement(By.tagName("iframe")));

The above line switch my driver (the one that i use for my test) into a frame because the inputs and the buttons that I want to click on are in this frame.

So i execute these lines after the switch :

WebElement emailAddressLogin = driver.findElement(By.id("email"));
emailAddressLogin.sendKeys("MYMAIL");
WebElement passwordPayPalLogin = driver.findElement(By.id("password"));
passwordPayPalLogin.sendKeys("MYPASSOWRD");

To sum up I locate the inputs that I want and I send what I want to see in the input. After that I Have to press the Login in button so I wrote this ...

 WebElement Login = driver.findElement(By.id("btnLogin"));

And after this line is the problem...

After I login I have to press the LAST button which is the 'Continue' button. This button will take me back to the magento form so to complete shipping information e.c.

I can not 'click' on this button. I wrote a line :

WebElement continuePaymentForPayPal = driver.findElement(By.xpath("//input[@type='submit']"));
     continuePaymentForPayPal.click();

But the console of Eclipse answers me that it can not find an element with the above xpath. i tried with id, cssSelector, className even with text but nothing happend. So is there any solution please share it.

Thank you !

Aucun commentaire:

Enregistrer un commentaire