how to throw when user click on save button without entering the input value. How I can achieve it only in html or angularjs - input

how to throw when user click on save button without entering the input value. How I can achieve it only in html or angular
how to throw when user click on save button without entering the input value. How I can achieve it only in html or angular

Related

How to handle dynamic text with no div tags and no info where they are coming from in Selenium?

I have registration form for which I am trying to create a script.If we don't enter any value in any of the fields and click submit, it is showing a dynamic error message that "Please fill out this field!"
There is no div tag for this text. Moreover, if we click anywhere on the screen, it is disappearing. Can anyone tell, how to read this text?
Thank you.
When the field is marked as required, the Browser shows the message when the form is submitted. There is no way available for you to access it.
You can handle it within your test code by checking that all required fields are entered before submit is called.

Selenium C# Webdriver How to detect if button is clicked

I am using selenium with IE to automate web testing. My webpage fills out a form and finally clicks a button. Code to click button is
driver.FindElement(By.CssSelector("td.ne-fieldvalues > input[type=\"button\"]")).Click();
8 out of 10 times, it Clicks but other time click command is never executed.
Is there way I can check if button was indeed clicked ? something similar to checkbox
if (!driver.FindElement(By.CssSelector("input[type=\"checkbox\"]")).Selected)
driver.FindElement(By.CssSelector("input[type=\"checkbox\"]")).Click();
I tried .Displayed and .Enabled and both these properties are always true.
Thanks for help.
To ensure that an action is performed on a click of a link or button, it is best to verify the resultant state of application. For eg. if I click on 'Log in' button after entering valid username and password, it will take me to my homepage, verify that homepage has loaded, else fail the click event. In case of invalid username/password, verify the warning message on login page itself.
To summarize, you have to validate the response to verify click event on any web element.
The least you can do is ensure that the element is clickable using ExpectedConditions.elementToBeClickable():
// In Java
WebDriverWait wait = new WebDriverWait(driver, timeOut);
wait.until(ExpectedConditions.elementToBeClickable(locator));

Selenium ClickandWait

Using id=incidentsCheckBox gets me an error but when clicking manually it shows up fine. What is the best way of capturing dynamically generated icons (incidentIcons), which pop up when a checkbox is clicked, which if click individually will show a popup data of status?

How to create link in SharePoint custom text field?

I have created custom text field MyItemURL, I am trying to achieve thru coding if user click on Click Me the link should open, but in my coding entire url is appearing under MyItemURL. Just wanted to display Click Me link, how can i do this?
Here is my code:
string completeURL="MyItemComplete URL generated here";
listitem["MyItemURL"]=" Click Me ";
listitem.update();
In listitem["MyItemURL"]=" Click Me you are assigning the value of a text field, not an HTML fragment. If you want a URL field, then use SPFieldUrl and not SPFieldText.

PDF creation with page refresh

I have a page with a viewPanel and a dialog. When an item in the viewPanel is clicked, the dialog opens, prompting the user to make changes to that item, and offering them the option to generate a report of the item in PDF format.
At first, I tried putting the PDF creation onto a button, as described here: http://www.eknori.de/2011-10-25/xpages-to-pdf-with-itext/ However, whenever the button is pressed, I get a "NotFoundError: DOM Exception 8" which seems to stem from the dojo JS. So currently I have an alternative whereby the button simply sets some sessionScope variables and opens a pdf.xsp XPage, where the variables are read back and the PDF is created.
The PDF gets created correctly, but it also means that the page that the user is on won't be refreshed to display their new change in the viewPanel. I've tried adding page redirects at the bottom of the XPage which creates the PDF, but with no luck.
So, how can I create a PDF and prompt a user to download it, but also refresh the page that they are currently on?
Are you isseuing an partial refresh on the button to hide your dialog and to execute the code for pdf generation? If so you I think that there is your problem. What you could do is to do a partial refresh on the onClose() method of the dialog to refresh the viewpanel. In the clientside onunload method you could open a so called xAgent which renders the pdf for you in a new window (window.open(pdf.xsp?docid=xxx). Take a look here: NotesIn9: 039 Creating PDF’s with XPages Part 2
Of cours the problem with this approach is that when you have a button / image in yoru viewpanel row that displays if the report has been created is not shown because the xagent runs after the / during the time the viewpanel row is being refreshed.