Hello I have the following code:
async function pressNext(nightmare) {
const check = await check_nextButton(nightmare);
const disabled= await check_disabled();
if(check&&disabled) {
await nightmare.click('#example_next');
await extractInfo(nightmare);
return pressNext(nightmare);
}
return null;
}
It is supposed to click the next button on a table as long as it exists , the problem is that the button exists even after it becomes disabled, so I can't think of any way to check if the "next button" is disabled The check disabled function is just something I've tried but didn't work , so I need to somehow make that function be true only if the #example_next
is not disabled EDIT: image of Next enabled
I tried comparing the classNames and that doesn't work
You can use .disabled
:
if(!your_button.disabled){ //if not disabled
# Do something
} else {
# Do something
}
So I've fixed it guys , I've made a function that fixes it , verifying if the selector for the disabled class exists , i the folllowing
async function check_disabled(nightmare){
return nightmare.exists('.paginate_button.next.disabled');
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.