I want to customize default popup on create using redirect new page instead - isis

On Action create as bellow
#Action
public EmployeeVM newEmployee(final String name) {
employeeRepository.create(name);
return this;
}
It show popup
Is it possible to redirect to a new page with the back button and save button instead of popup.

Related

Selenium webdriver not finding add to cart button in Amazon

After selecting a product and opening it in another page Im not able to click on add to cart button in amazon using selenium.
If you are not switching to other page, Add to card option will not be located.
Switch to the opened page and then try to click on the button.
handles = driver.window_handles
driver.switch_to.window(handles[1])
driver.find_element_by_id("add-to-cart-button").click()
If you have done this, share the code you have tried and error you get.
Without HTML page you are trying to perform, it is difficult to pinpoint exactly. However, I would like to take a stab at it considering these:
Click on product in home page
Product opens in a new tab window
Click on add to cart
P.S: I will write it using Java since you haven't mentioned on the language being used. Will be similar in others as well
Click on product in home page
List <Webelement> productCheck = driver.findElements(By.xpath("<xpath of the product>"))
if (productCheck.size() == 0){
// do something
else {
driver.findElement(By.xpath("<xpath of the product>")).click();
}
Product opens in a new tab window and Click on add to cart
String parent = driver.getWindowHandle();
List<String> windows = new ArrayList<String>(driver.getWindowHandles());
driver.switchTo().window(windows.get(1));
// Inside the tab window
List <WebElement> addtoCartButton = driver.findElements(By.xpath("<xpath of Add to cart button>"));
if (addtoCartButton.size() == 0 ) {
// do something
else {
driver.findElement(By.xpath("<xpath of Add to cart button>")).click();
}
// do whatever you want in the new tab and if you want to switch back then:
driver.switchTo().window(parent);

Selenide IntelliJ IDEA - inserting text from current clipboarrd into the Login form instead of #

I have a wierd problem:
Our Selenide automat keep inserting the text, that is currently in my clipboard into the login form, that use email.
The text is inserted instead of #:
The code is as follow:
B2CLogin login = new B2CLogin();
login.userCanLogIn();
B2CLogin include:
public class B2CLogin {
#Test
public void userCanLogIn() {
DevBasicAuthorization auth = new DevBasicAuthorization();
auth.userCanAuthorization();
//open login popup
$("[data-test-id='Navigation-item-signIn']").click();
//choose LogIn
$("[data-test-id='signInForm_sign_in_tab']").click();
//fill login
$("[id='username']").setValue(b2cdevuser);
//fill password
$("[id='password']").setValue(b2cdevpass);
//click LogIn button
$("[data-test-id='signInForm_submitButton']").click();
//Profile button should be visible
$("[id='Navigation-item-profile-desktop']").waitUntil(Condition.visible, 6000);
}
Variables:
//b2c dev account
public static String b2cdevuser = "CZtestB2B#gmail.com";
public static String b2cdevpass = "test1234";
Do anyone know hoe to solve this?
Thank you in advance

Display string in xml format in browser either using view or controller

I have a string in my model.The string is actually XML content. I have a link on my page, when clicked it opens a new tab and displays the text as XML.
The result should be the same as when I right click on an xml file and open with Internet Explorer. The difference is that this is no file, its text that I need to display as XML in a new tab.
Anyone have an idea how to achieve this without creating a file and without giving a path to a file.
You could have a controller that will serve this XML and set the proper content type header:
public class MyXMLController: Controller
{
public ActionResult Index()
{
MyModel model = GetModelFromSomewhere(...);
return Content(model.StringPropertyContainingXML, "text/xml");
}
}
now all that's left is to write an anchor link pointing to /myxml/index:
#Html.ActionLink("Click to open XML", "index", "myxml", null, new { _target = "blank" })

Unable to navigate backward using hardware key in a Universal App

I navigate forward using Frame.Navigate but when I press the hardware back key on my phone I end up on the start screen and not the page I just visited.
What might be wrong?
The reason behind your problem is, you are creating a Blank Page. If you're creating a blank page, you should define what the app has to do when the back button is fired.
Better, consider adding "Basic page". It will have backstack by nature. If you are navigating from the MainPage to the Basic Page and when you pressed back button at the Basic Page it will back to the MainPage.
I hope this could solve your problem!
If you want to use Blank Page in your application, you need to use like this on your page where you wanna override back button:
add this in your header:
using Windows.Phone.UI.Input;
and then in your constructor:
HardwareButtons.BackPressed += HardwareButtons_BackPressed;
add this anywhere in your code:
void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
{
HardwareButtons.BackPressed -= HardwareButtons_BackPressed;
this.Frame.Navigate(typeof(MainPage));
e.Handled = true;
}
You've probably forgotten to use the NavigationHelper included in the template of the universal app.
You should use it like this on every page:
NavigationHelper _navigationHelper;
public LoginPage()
{
this.InitializeComponent();
_navigationHelper = new NavigationHelper(this);
}

Window phone - How to redirect to page xaml form web browser control?

I have two page xaml contain web browser control to display html string.For example,
page1.xaml : Contain webbrowser control (will display html string to web browser control)
page2.xaml : Contain webbrowser control
Question is : When user click a tag hyperlink in page1.xaml and how to redirect to page2.xaml
you can simply use the java script function that call the your native C# function by this you can call the native function from web browser and redirect the page.
so please create the one html file inside the html use the Javascript function that call the native function or notify from there.
You need to inject Javascript in the HTML that will enumerate all a tags and wire up an onclick event. That event will call window.external.Notify which will in turn raise the ScriptNotify event of the WebBrowser, with the URL as a parameter.
Here is the code:
// Constructor
public MainPage()
{
InitializeComponent();
browser.IsScriptEnabled = true;
browser.ScriptNotify += browser_ScriptNotify;
browser.Loaded += browser_Loaded;
}
void browser_Loaded(object sender, RoutedEventArgs e)
{
// Sample HTML code
string html = #"<html><head></head><body><a href='http://www.google.fr'>Google</a></body></html>";
// Script that will call raise the ScriptNotify via window.external.Notify
string notifyJS = #"<script type='text/javascript' language='javascript'>
window.onload = function() {
var links = document.getElementsByTagName('a');
for(var i=0;i<links.length;i++) {
links[i].onclick = function() {
window.external.Notify(this.href);
}
}
}
</script>";
// Inject the Javascript into the head section of the HTML document
html = html.Replace("<head>", string.Format("<head>{0}{1}", Environment.NewLine, notifyJS));
browser.NavigateToString(html);
}
void browser_ScriptNotify(object sender, NotifyEventArgs e)
{
if (!string.IsNullOrEmpty(e.Value))
{
// Navigate to Page2.xaml
NavigationService.Navigate(new Uri("/Page2.xaml", UriKind.Relative));
}
}
The solution that you are looking for is deeplinking your app to listen to custom URL protocols.
First setup your solution to listen to custom URLs. Follow the URI association section in this MSDN document. http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206987(v=vs.105).aspx#BKMK_URIassociations
Next in your web browser when you display a link make sure it is an absolute URL starting with your own protocol and NOT http or https.
So, your final url in the web browser must contain something like that: my_protocol://abc.xaml
In the AssociationURIMapper class, you catch such URLs and navigate to the desired XAML page.
This solution will not only enable your app to open from a web browser but also from other applications on windows phone!