I have web page in which it displays only 10 items if there are more then 10 items on the page then show more button displays, so need to click on show more button to see more then 10 items.
Problem is when I click on show more button it will display 10 more item and then again i have to click show more button to see next 10 more item and once all items are displayed on the page then show more button disappears from page.
Here I want to click show more button until all the items are displayed
How to achieve this using Selenium + Web driver?
Until "show more" button present keep clicking on that link in loop.
while(isElementPresent(By.linkText("Show more"))) {
driver.findElement(By.linkText("Show more")).click();
Thread.sleep(100);
}
Check here for isElemenetPresent() methods implimentation.
P.S : For safety break the loop after reaching some max limit.
Related
I have created a page where there are 2 section (2 controllers and 2 views).
The section in the left has categories (category_selector), and the section on the right displays items in the category that was selected in the left section (category_item_display).
There are many items in a single category, so pagination is implemented in category_item_display.
Pagination works by loading 20 items and then shows a button 'Show More' if there are more items in the category. Clicking the button will add another 20 items to the page.
When an item is clicked, the page is changed to item details page and the item details are displayed.
Now here is the problem.If I click on 'Show More' button once or more, then more than 20 items are displayed in category_item_display. But once I navigate to item details page and then click back button, again the controller loads and shows only 20 items in category_item_display.
So what I did was that the number of items to be loaded is checked from a URL parameter 'loaded_items' first, and if not found then default 20 is picked.
A URL search parameter 'loaded_items=' is added to the address when an item is clicked, and then the address is changed. I did this by having both ng-ref and ng-click on the anchor element, so that ng-click will execute first which has $location.search('loaded_items', count);
I did not want to store the loaded items count in the URL as soon as 'Show More' is clicked, because if I select another category the loaded items will be as per this count.
I want to remove the URL parameter 'loaded_items' on controller init after recording the value somewhere so that the list can be retrieved. But $location.search('loaded_items', null); is reloading the page again and hence the loaded items seems to be items loaded repeated twice.
How can I achieve this?
Thanks in advance
Balu
As told by jbrown, I added the items to the service. Along with it,
ng-click call back will add the selected item id to the service. Now
when I click back button, the item list will be unaltered because it
is in the service. Using $anchorScroll in $timeout, the screen can be
scrolled to the exact item (using id) that was selected.
Thanks everyone.
I have a kendo grid which has buttons in every row, On click the buttons open a pop-up with different grid on each button click, so problem is--
When I click on any button for first time grid opens with it's related data. When I close that grid and open another grid, I get the same data as previous one
When I reload the page and open any grid for 1st time it works fine, If I open a second one again it repeats
What I understood from Network Recording is it is not requesting data from api on 2nd button click and directly using data present in it previously.
Here is an example of the given problem using local data, can you please help
Dojo Example.
In ext js I have a form panel that will add items on tab click i.e. items related to clicked tab.Im destroying the before created items and adding new items to the panel. Items are getting added properly but panel is not displayed. When I press f12 or if im using f12 if I close the console at this time the panel is shown. on f12 window open or close the panel is shown. Why not before ? What could be the problem?
I assume that you are using a Chrome browser and pressing F12 shows/hides the developer tools. So this action resizes the viewport, forcing a refresh of the panel layout and the components become visible.
When adding/removing items from a panel a yourformpanel.doLayout() could help recalculating the layout.
Another option is to embrace the adding/removing of items with the following code:
Ext.suspendLayouts();
... // add/remove items here
Ext.resumeLayouts(true);
BTW: More details on your problem would be helpful (e.g. code snippets, ExtJS version).
I am facing an issue in listening to the click event for hyperlink in extjs grid. Actually I have a form whose display field’s value is a hyperlink. On click of this hyperlink, I show a window pop-up which a grid(single column) and has multiple values,one value for each row(which are again hyperlinks). On click of this I show a form. On the click of hyperlink on grid column, I have this listener:
cellclick:function(){
Ext.getBody().on(‘click’,function(event,target){
MyModel.getProxy().url = ‘…’;
MyModel.load({
scope:this;
callback:function(){
}
});
},null,{
delegate:’.className’
});
}
On click of the hyperlink on grid row, there is a call to the rest service. When I click on any value for the first time, it works fine. When I click on any other value, there are two service calls, one for the value that is clicked and one for the previously clicked value and this goes on increasing with the increase in the number of clicks.How can I avoid this?Is there any other way to listen to the hyperlink click event?Any help is highly appreciated.Thanks….
I am using twitter boostrap to implement tooltip for my web app (twipsy)
My implementation is as follows:
%li.friend
%a{:href=>"#!/<%=nick%>/<%=question_slug%>", :rel=>"twipsy", :title=>"click to see xxxx's muse"}
%img{src: "<%= avatar_url %>"}
The sequence of steps is as follows:
1) Hover on the avatar I want to click => tooltip appears above avatar (no issue)
2) Click on avatar to load a new page
3) New page is loaded but the tooltip shown in 1) did not disappear and just remain displayed on the newly loaded page.
Is there any additional parameters I need to set to ensure that the tooltip disappears in step 3)?
As tooltip toggles on mouseenter and leave when you click the element and DOM structure is replaced with new page the mouseleave on the avatar is never triggered as the element was removed programmatically while mouse was hovering over it.
To fix that you need to call the .tooltip('hide') method when you click the avatar.