I'm trying to set a birthdate on the Discord Register page using Selenium, but I am not exactly sure how. I also tried searching online how to set a birthdate similarly to how Discord does it, but can't find any.
CodePudding user response:
I figured it out, nvm. Part of the code of how I did it.
let findmonthButton = tab.findElement(swd.By.className("month-1Z2bRu"));
return findmonthButton;
})
.then(function(findmonthButton) {
let promiseMonthButton = findmonthButton.click();
return promiseMonthButton
})
.then(function() {
console.log("Month clicked successfully");
let findmonth = tab.findElement(swd.By.className("css-rzbxvl-option"));
return findmonth;
})
.then(function(findmonth) {
let promiseMouth = findmonth.click();
return promiseMouth
})
.then(function() {
console.log("January clicked successfully");
let findDayButton = tab.findElement(swd.By.className("day-1uOKpp"));
return findDayButton;
})
.then(function(findDayButton) {
let promiseDayButton = findDayButton.click();
return promiseDayButton;
})
.then(function() {
console.log("Day clicked successfully");
let findDay = tab.findElement(swd.By.className("css-1yz4bi9-option"));
return findDay;
})
.then(function(findDay) {
let promiseDay = findDay.click();
return promiseDay;
})
.then(function() {
console.log("Day clicked successfully");
let findYearButton = tab.findElement(swd.By.className("year-3_SRuv"));
return findYearButton;
})
.then(function(findYearButton) {
let promiseYearButton = findYearButton.click();
return promiseYearButton;
})
.then(function() {
console.log("Year clicked successfully");
let findYear = tab.findElement(swd.By.xpath("//div[text()='1997']"))
return findYear;
})
.then(function(findYear) {
let promiseYear = findYear.click();
return promiseYear;
})
.then(function() {
console.log("a Year clicked successfully");
let promiseSignInBtn = tab.findElement(swd.By.className("button-1cRKG6 button-f2h6uQ lookFilled-yCfaCM colorBrand-I6CyqQ sizeLarge-3mScP9 fullWidth-fJIsjq grow-2sR_-F"));
return promiseSignInBtn;
})
.then(function (signInBtn) {
// Step 7 - Clicking the Sign In button
let promiseClickSignIn = signInBtn.click();
return promiseClickSignIn;
})