Reputation: 37
I'm trying to login on fifa ultimate team... but i don't know why if i try to use wait the click action did not anything... basicly my url is https://www.easports.com/fifa/ultimate-team/web-app/ and the button i need to click is Login any idea?
require('chromedriver');
const webdriver = require('selenium-webdriver');
var until = webdriver.until;
var By = webdriver.By;
async function myMain(){
let driver = new webdriver.Builder().forBrowser('chrome').build();
await driver.get('https://www.easports.com/fifa/ultimate-team/web-app/');
await driver.wait(until.elementLocated(By.className('btn-standard call-to-action')), 15000);
await driver.findElement(By.className('btn-standard call-to-action')).click();
}
myMain();
Upvotes: 1
Views: 2846
Reputation: 5909
Your selector might not be quite right. Try this:
await driver.wait(until.elementLocated(By.xpath("//button[text()='Login']")),15000);
let loginButton = driver.findElement(By.xpath("//button[text()='Login']"));
await driver.wait(until.elementIsEnabled(loginButton ,15000));
await driver.findElement(By.xpath("//button[text()='Login']")).click();
Upvotes: 1