-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seleno: Using strongly typed controller action expressions to navigate to the page via routing. #239
Comments
You need to use the appropriate configuration overload to register a route table that contains the routes from your mvc project. Let me know if you want me to dig up an example code snippet from our example projects.
|
Hi @wijdenchebbi. Here is an example from our docs, where RouteConfig.RegisterRoutes would be the method that configures the routes in your web application:
You can read more about it here. |
Thanks for getting back so quickly. i used the appropriate route table, when i used a static URL ,it works correctly, but when i used the controller and action it doesn't work. |
Can you paste in your configuration code? And the navigation code?
|
To have an instance on seleno host i make the class BrowserHost
the navigation code used in a method in the class EditCustomerStory.cs
EcitCustomerPage.cs is the page object |
Hi, when i use a static URL: |
Re: your first problem, if you use Re: your second problem when you say "sometimes it doesn't" work what do you mean? Do you get an exception? Does the page change, but to the wrong URL? Does nothing happen? ... Thanks :) |
Thanks for your response, |
Hi @wijdenchebbi . Your second problem looks like the URL you are trying to navigate to requires authorization and so it is redirecting you to the login page. You will have to login earlier in the test before making that call. With regards to your Navigate.To method, you need to add the generic arguments to the call. It's quite hard to know what is happening with the NavigateToInitialPage method. Could you possibly provide a small sample of code that I can download and look at more closely? You might also want to install MvcRouteTester and try the same controller/action combinations you are trying here and see if you get the results you expect. (Our code is generating URL from the route table in a similar way to MvcRouteTester). |
Hi,
}
}
} |
Hi @wijdenchebbi . It looks like you are using Areas in your URL. If that's the case then you need to use the overload of Navigate (of NavigateToInitialPage and navigation within page objects) that takes a dictionary of route values. I wrote a bit of background about that here. Another point I would make is that NavigateToInitialPage is only designed to be called once to get you the first page object. From that point on the methods in the page objects should return page objects using the UIComponent Navigate.To method. When using BDDfy methods like you are you will need to have page objects fields that get set by the first method and then the second method will use the same field. |
Hi,
I am a software engineer, my task is to realise an test acceptance for ASP.net MVC C# project.
I want to generate the page object by specifying navigation by selecting a controller and action (rather than a Url string). this is my code:
And i add an instance of seleno host:
And the link generated is wrong:http://localhost:13050/fr/?Controller=Client&Action=Edit&id=22
Can you help me? Thanks
The text was updated successfully, but these errors were encountered: