Entering text into an alert - selenium

I'm currently having difficulty writing a test that enters text into an alert prior to accepting/dismissing said alert.
I'm able to accept an alert with:
page.driver.browser.switch_to.alert.accept
However, when I attempt to use the following to enter text into the alert with:
page.driver.browser.switch_to.alert.text("test")
I get the following error:
Failure/Error: page.driver.browser.switch_to.alert.text("test")
ArgumentError:
wrong number of arguments (1 for 0)
Does anyone happen to have any experience with this workflow?
Thanks!

Update that works:
prompt = page.driver.browser.switch_to.alert
prompt.send_keys('test')
prompt.accept

Related

Laravel validation wouldn't prompt error message when combine multiple validation condition

I am developing a registration API using Laravel. One of the field which is date_of_birth, I planned to make it optional and with the type of date.
Therefore, I am writing this line of code inside my RegisterUserRequest file:
But the output is when I leave this field to empty or enter a correct date, it will pass the validation and execute my controller function as expected. But when I provide a wrong date, the validation is failed (which is expected) but the problem is the validation message wouldn't show out. The response received is empty.
Is anyone know what should I do in order to display error message for entering incorrect date format in this case?
Thank you.

Twilio mobile number verification - VerificationCheck was not found on Express

The requested resource /Services/serviceSSID/VerificationCheck was not found is the eroor showing in the console
my code is
otpLogin:async (req,res)=>{
console.log(req.body.otp);
try {
const isOTP = await client.verify.services(serviceSSID).verificationChecks.create({
to:`+91${req.body.phone}`,
code:req.body.otp
})
if(isOTP)console.log(isOTP);
return res.status(200).json({message:" mobile number verified"})
} catch (error) {
console.log(error.message)
return res.status(500).json({message:"something went wrong"})
}
}
Twilio developer evangelist here.
From the documentation:
Twilio deletes the verification SID once it’s:
expired (10 minutes)
approved
when the max attempts to check a code have been reached
If any of these occur, verification checks will return a 404 not found error like this:
Unable to create record: The requested resource /Services/VAXXXXXXXXXXXXX/VerificationCheck was not found
If you’d like to double check what happened with a given verification - please use the logs found in the Twilio Console under your Verification Service:
I've found that if you submit a form twice by clicking a submit button twice quickly, that the verification is successfully checked and then because it was a success deleted, then the second check fails with a 404 like this and that is the error result you see. To avoid this, you should stop users from being able to submit the form twice by disabling the submit button after the first attempt.
I can confirm that philnash 2nd statement is correct. However wouldn't it have been handled way better if instead we just get a response from client.verify.services(serviceSSID).verificationChecks that the 2nd (and so on checks) failed??

Change coupon.invalid.code.provided text as GlobalMessage

I'm trying to display the custom message, Invalid voucher code. when applying an invalid voucher code.
I see the GlobalMessage voucher.applyVoucherSuccess defined in cart-voucher.effect.ts
and its actual text in the translations/en/cart.ts file
But how can I edit the error message when there's an invalid voucher code input?
Or if there's an easier way of doing it in spartacus?
Currently, there's no easy way or best to do in Spartacus until further notice. However, we do have a way to change the error message for invalid voucher code.
For example, look at the bad-request.handler.ts.
You can catch the specific error, which is VoucherOperationError. Using this error.type from the error response of {message: "coupon.invalid.code.provided", type: "VoucherOperationError"}, you can point to the translations key or your custom message using the raw property.

Selenium + not able to verify action success using flash message

if(<webelement>.getText() == "Flash_Message_text")
System.out.println(<message to be printed>);
else
System.out.println(<webelement>.getText());
waitFor(3000);
Once I perform an action and it is successful, then a flash message is displayed. As per the above code, I am identifying the flash message and using its text to verify if the action completed successfully or not.
However, it is never executing the "if" part of the code, and it is always printing from the "else" part.
Is there anything I am missing, or is there any other way I can handle this?
Try .equals() instead of == for String Comparison!

unable to create a user in JXplorer for LDAP - i get an error

I am trying to user openLDAP for the very first time. So I found this nice tutorial http://soswin-techbits.blogspot.com/2011/10/installing-openldap-on-windows-7.html. So i followed the instructions all the way to end. However, on the very last step I get an error. When i try to add a user to the group people I get this errpr "Unable to perform Modify Operation."
So after i do cn=user1 then in the Table Editor I type "surname" and hit submit then I get this error.
even when I tried to add a new directorey I get the same error.
Here is a detailed error.
javax.naming.OperationNotSupportedException: [LDAP: error code 53 - no global superior knowledge]; remaining name 'dc=Organization,dc=com'
What is wrong?
thanks
The server may not be configured to host a backend with the suffix dc=Organization,dc=com.