Validation Of Success Message in Selenium Java - selenium-webdriver

Hello Guys I am trying print out "The product has been added to your shopping cart" from the popup window which disappears in 10 seconds, In the console After I add product,Could someone assist me with that
String expectedTitle = "The product has been added to your shopping cart";
if(actualTitle.equals(expectedTitle)){
System.out.println("Title bar message verified successfully");
}else{
System.out.println("Title bar message verification failed");
}
the above is what I used not so sure , if that's the right way.
enter image description here
String expectedTitle = "The product has been added to your shopping cart";
if(actualTitle.equals(expectedTitle)){
System.out.println("Title bar message verified successfully");
}else{
System.out.println("Title bar message verification failed");
}
tried the above code , and the result I see in console "Title bar message verification failed"

Related

I tried to check if phone number is already registered but it shows all numbers (Including registered numbers) not Registered in firebase

[enter image description here][1]I tried to check if phone number is already registered but it shows all numbers (Including registered numbers) not Registered in firebase realtime database.
I tried Many ways to check but I failed There is no error showing in code but my database have child num.
if(snapshot.hasChild(num)){
String checkpass=snapshot.child(num).child("password").getValue(String.class);
if(checkpass==pwd){
Intent iopen=new Intent(Login_page.this,Home.class);
startActivity(iopen);
}else{
Toast.makeText(Login_page.this, "Incorrect Password", Toast.LENGTH_SHORT).show();
}
}else{
Toast.makeText(Login_page.this, "Phone number not Registered", Toast.LENGTH_SHORT).show();
}
}

How do I get my bot to send a message when an unauthorized user presses a button? discord.js

So, I'm making a bot, and I'm working with buttons at the moment, and when someone runs a command for example ;buy item and they press a button, it does stuff yk, but when someone who isn't the message author press the button, the bot also responds, and I don't want this. I want my bot to just send maybe an ephemeral message to the user saying something like, "This button isn't for you" or something. So, my question is, how do I make my bot send a message when a user who isn't the message author presses the button.
You can just do that using an if statement in the start of your collector. After you make a messageComponentCollector() in your channel, in the top of it, you can add:
collector.on('collect', (click) => {
if (click.user.id !== message.author.id) {
return click.reply({
content: 'This button is not for you!',
ephemeral: true
})
}
})

how to create a hyperlink within a meteor error string

I want to make a section of my meteor error string as a link.
if (customer.password) {
throw new Meteor.Error('server-error_email-in-use', 'Email already in use with a non-guest account, please log in to complete your order');
}
how can i make "log in" a hyperlink to login page?

How to show Feed back message in sales force Standard page?

I want to show a Feed back message in sales force Standard page on custom button click using visual force page on the basis of Apex class logic.Any one who can help me?For example if some thing successfully done then success message and if not error message should display on standard page.
You can create a new method to handle your messages
private void displayFeedback(ApexPages.Severity msgType, String message)
{
ApexPages.Message msg = new ApexPages.Message(msgType, message);
ApexPages.addMessage(msg);
}
Build your message you want to show..
displayFeedback(ApexPages.Severity.Error, String.valueOf(TripProfileHandlerServices.ERROR_SAVING_DATA + missingDataError));
Put this message in your VF page
<apex:pageMessages id="feedback" />
You will also have to rerender='feedback" when you want show the message after an event
If you put a <apex:messages /> in the page, you can use the message class to fill it up.

How to send key to click Yes button in WebDrive

When I activate a url via Webdrive that start up a Word Document a dialogbox with a Yes or No is started up .
How do I send in keys to click the Yes-button in Webdrive.
First you need to switch to the particular window using the following method -
WebDriver.switchTo().window()
If the name is not known, you can use
WebDriver.getWindowHandles()
to obtain a list of known windows. You may pass the handle to
switchTo().window().
If it's JavaScript you can use -
// Get a handle to the open alert, prompt or confirmation
Alert alert = driver.switchTo().alert();
// Get the text of the alert or prompt
alert.getText();
// And acknowledge the alert (equivalent to clicking "OK")
alert.accept();
Hope this helps!

Resources