how to check to see if is in viewpoint - watir

I'm sporadically receiving the following:
Selenium::WebDriver::Error::UnknownError: unknown error: Element <tr _ngcontent-c7="">...</tr> is not clickable at point (1101, 18). Other element would receive the click: <div _ngcontent-c1="" class="col-md-6">...</div>
(Session info: chrome=64.0.3282.140)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.1.7601 SP1 x86_64)
This occurs from a page that has a table where the rows extend past the viewpoint.
the method that I'm using to select a random row in the table
def get_random_row
random_row = rand(1..self.policy_results_row_count)
row = self.policy_results_element.row_element(:index => random_row)
row.focus
self.wait_until(10, 'Row not in focus') do
row.visible?
end
row.click
end
Is there a way to check to see if an element within Viewport after #focus?

The fact that it is or is not in the viewport makes no difference inherently. What will make a difference is how the responsive design of the CSS is working for your application at different resolutions. You can change the window size if that makes a difference. If the issue is that there is a static header that the element is hiding under, you can use the excellent watir-scroll gem to move the element out from under the static header.

Related

Where is scripted the Dalaran Well teleport (game object)?

When you try to reach the Dalaran Well in Dalaran, you are teleported to the sewers.
It is using this Game object: Doodad_Dalaran_Well_01 (id = 193904 )
Where is it scripted? How?
I've found nothing in the table smart_scripts, and found nothing in the core about this specific id so I'm curious because this type of teleport is really better than clicking on a game object
This gameobject is a unique case because it works like instance teleports do. If you check the gameobject_template table, you will see that it has several Data columns that have diferent values based on the type of the gameobject.
The gameobject you are refering too is the Well It self but the portal gameobject inside the well gives the player a dummy spell to tell the core that the player has been teleported (spell ID 61652).
For the specific case of the dalaran well, it's type is 30 which means, as the documentation says, GAMEOBJECT_TYPE_AURAGENERATOR. As soon as the player is in range, a dummy aura is cast on him to notify the core that this areatrigger has been activated (You could do stuff when player gets hit by the dummy spell).
The trick here is a bunny, but not the bunny itself since it is there mostly to determine an areatrigger. If you use command .go gobject 61148 you can check him out, he's inside the well.
Areatriggers are a DBC object that are actually present on our database on world.areatrigger. You can check the columns here. When the player enters the Radius box specified on the areatrigger, another thing happens in the core which is world.areatrigger_teleport.
If you run the following query you will be able to check the position where the trigger will teleport the player to.
SELECT * FROM areatrigger_teleport WHERE `Name` LIKE '%Dalaran Well teleporter%';

Paste elements to another graph in Rappid?

I am building an administration tool thats manipulates diagrams, using JointsJS + Rappid. I am trying to copy paste elements from one paper A to another paper B (located on different browser tabs) but I face the following problem:
I can copy-paste from A to B one set of elements (that's good)
I can even paste it several times (that's still good)
but if I copy another set of elements from A, and try to paste it into B, the former set is pasted, instead of the new one
I can still paste elements from A into A, and B into B, but not from one to another anymore.
It seems that this behaviour is the same in the Kitchen Sink Rappid demo: if I open 2 tabs on the demo, I face exactly the same problem. You can reproduce it easily by opening 2 tabs with the demo app.
This is my piece of code (directly taken from Rappid demos):
this.clipboard = new joint.ui.Clipboard();
this.selection = new joint.ui.Selection({
paper: this.paper,
handles: App.config.selection.handles,
collection: new Backbone.Collection
});
this.keyboard = new joint.ui.Keyboard();
this.keyboard.on({
'ctrl+c': function () {
// Copy all selected elements and their associated links.
this.clipboard.copyElements(this.selection.collection, this.graph);
},
'ctrl+v': function () {
var pastedCells = this.clipboard.pasteCells(this.graph, {
translate: {dx: 20, dy: 20},
useLocalStorage: true
});
var elements = _.filter(pastedCells, function (cell) {
return cell.isElement();
});
// Make sure pasted elements get selected immediately. This makes the UX better as
// the user can immediately manipulate the pasted elements.
this.selection.collection.reset(elements);
},
}
In the Rappid documentation, it is stated that:
"Additionally, clipboard is also able to copy cells from one paper and
paste them to another. However, the determination of the targeted
paper is left to the application layer."
I didn't fully understand the second sentence ("However ..." to end).
I monitored the local storage and discovered that both papers probably use the same storage entry, which make me think inter-graph paste is managed.
At this stage, I am struggling to find whether:
my code should perform inter-graph copy-paste at all,
I am doing something wrong,
there is a bug in Rappid (considering that this behaviour is the same in the official demo).
Thanks for your help.
I've had an answer from the Rappid crew and this is a bug in Rappid which is being fixed.
The fix will be embedded in the next release (2.5 probably).

xPages REST service to feed a Notes Calendar Store

I am trying to use RESTservice to get data from a resource reservation DB and provide a calendar with filter capability by resource name.
All run fine while I use the rest service without filter
<xe:restService id="restService2" pathInfo="/inoteslegacyjson">
<xe:this.service>
<xe:viewJsonLegacyService count="30000"
databaseName="${compositeData.databaseName}"
viewName="${compositeData.viewName}" defaultColumns="false"
var="entry" contentType="text/plain" compact="false">
<xp:this.columns>
<!-- Cal Date -->
<xe:restViewColumn name="$134"
columnName="StartDateTime">
</xe:restViewColumn>
<!-- Icon -->
<xe:restViewColumn name="$149" columnName="$149"></xe:restViewColumn>
<!-- Start Date -->
<xe:restViewColumn name="$144"
columnName="StartDateTime">
</xe:restViewColumn>
...
But when I put a search syntax like this:
<xe:this.search><![CDATA[#{javascript:
var isResourceFiltered:Boolean;
var strTmp:String=viewScope.resourceName;
isResourceFiltered=(strTmp.compareToIgnoreCase("All")!=0);
print ("Is result filtered:" + isResourceFiltered + ", filter: "+ strTmp);
if (!isResourceFiltered) {
return "";
}
return "ResourceName=" + viewScope.resourceName}]]></xe:this.search>
I cannot see any message in console about Print() and get some errors in page:
calendarDataStore: RequestError: Unable to load /admin/resource.nsf/ResourceCalendarFiltered.xsp/inoteslegacyjson status: 500
or error 400
How does can I filter a calendar view for resource name
(And how make a time slice to get only time period showed in the UI to avoid count="30000"?)
viewScope.resourceName may not be set early enough for it to be used. This could explain the lack of a print statement and the error 500 returned by the calendarDataStore.
Try adding some error handling to verify it's an issue with the component vs an error with your code.
XPages OpenLog Logger (or the corresponding code in OpenNTF Domino API) will catch uncaught exceptions and so would verify coding issues without needing try/catch blocks.
I did a Java Rest service and used FT Search to search between two date ranges. You could also work your search by resource name into that FT Search as well. In my case I did not use a view but did the lookup in Java and built the returned text in my code (to work with FullCalendar, a web based calendar). Works great and is fast.

completed an orchard tutorial on displaying a calendar but nothing displays?

I was trying to display some sort of booking system in orchard and I found a set of tutorials that allow you to set queries to display on different dates...
So ive went through all the 18 tutorials for orchard CMS 1.6 displaying a calendar on screen
http://www.youtube.com/watch?v=Iv7rA-viyTw
and my calendar doesnt appear on screen? ive tried changing the widget of it (which selects dates on the calendar) and nothing appears, im logged in as authentic user, (as it is set to show-when creating the widget)
The only thing I can think of (which shouldnt be a problem but worth mentioning - in tutorial 13 where you edit template. when I tried to select a query none where appearing from the drop down list, I created a query as in the tutorials but still none appeared on the content page.) - this threw an error when trying to create a 'calendar widget' so I commented the code causing this in calendarWidgetDriver.cshtml.
//if (part.QueryId <= 0)
//{
// updater.AddModelError("QueryId", T("You must select a query."));
//}
But this only matters when you want to display a query on a date. surely it shouldnt matter for displaying the entire calendar. I realise this is a bit of a jump for a large Q. but im hoping on the off chance someone has encountered the same problem.
If so I would be glad to know.
thank you all
I have tried contacting the owner but as of yet no word so thought I would try here....
EDIT 1...
Logs
2013-08-21 10:06:37,658 [32] Orchard.Environment.Extensions.ExtensionManager - No suitable loader found for extension "FoodPodBootstrapTheme"
2013-08-21 10:07:06,130 [32] Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator - ArgumentException thrown from IContentPartDriver by UMACS.FoodPod.Drivers.CalendarWidgetDriver
System.ArgumentException: queryId
at Orchard.Projections.Services.ProjectionManager.GetContentItems(Int32 queryId, Int32 skip, Int32 count)
at UMACS.FoodPod.Services.CalendarService.GetCalendarEvents(CalendarWidgetPart part)
at UMACS.FoodPod.Drivers.CalendarWidgetDriver.<>c__DisplayClass3.<Display>b__2()
at Orchard.ContentManagement.Drivers.ContentPartDriver`1.<>c__DisplayClassf.<ContentShape>b__e(BuildShapeContext ctx) in C:\WORK\Orchard1.6.1\Orchard.Source\src\Orchard\ContentManagement\Drivers\ContentPartDriver.cs:line 130
at Orchard.ContentManagement.Drivers.ContentPartDriver`1.<>c__DisplayClass15.<ContentShapeImplementation>b__14(BuildShapeContext ctx) in C:\WORK\ Orchard1.6.1\Orchard.Source\src\Orchard\ContentManagement\Drivers\ContentPartDriver.cs:line 139
at Orchard.ContentManagement.Drivers.ContentShapeResult.ApplyImplementation(BuildShapeContext context, String displayType) in C:\WORK\ Orchard1.6.1\Orchard.Source\src\Orchard\ContentManagement\Drivers\ContentShapeResult.cs:line 39
at Orchard.ContentManagement.Drivers.ContentShapeResult.Apply(BuildDisplayContext context) in C:\WORK\ Orchard1.6.1\Orchard.Source\src\Orchard\ContentManagement\Drivers\ContentShapeResult.cs:line 21
at Orchard.ContentManagement.Drivers.Coordinators.ContentPartDriverCoordinator.<>c__DisplayClassa.<BuildDisplay>b__9(IContentPartDriver driver) in C:\WORK \Orchard1.6.1\Orchard.Source\src\Orchard\ContentManagement\Drivers\Coordinators\ContentPartDriverCoordinator.cs:line 49
at Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in C:\WORK\Orchard1.6.1\Orchard.Source\src\Orchard\InvokeExtensions.cs:line 17
EDIT 2
following the advice Ron gives at 7.40 of this video:
http://www.youtube.com/watch?v=jOSxGj2gOpY using 'Sources' from F12, he is able to view calendarWidget from inside localhost, i do not have this view able for me. What could i be missing?
The loader error means that Orchard cannot find the FoodPodBootstrapTheme.dll.
When i read ...
No suitable loader found for extension "FoodPodBootstrapTheme"
... i assume it is a project located in ...
src\Orchard.Web\Themes\FoodPodBootstrapTheme
You have most likely added this project to your src\Orchard.sln file in Visual Studio manually and therefore the project is not configured for building correctly.
I had the same error multiple times and this is what helped me to get rid of the error:
Fix theme build dependencies
Open src\Orchard.sln in Visual Studio
Right click on the FoodPodBootstrapTheme node and select Build Dependencies > Project Dependencies
now make sure Depends on contains a tick in checkbox Themes (Themes\Themes)
Fix Orchard.Web build dependencies
Open src\Orchard.sln in Visual Studio
Right click on the Orchard.Web node and select Build Dependencies > Project Dependencies
now make sure Depends on contains a tick in checkbox FoodPodBootstrapTheme

How can I get some particular link form the links collection

I'm using watir-webdriver have several lines of the same code shown below:
...
<p class="schedule-text">
by
MarketingClub
in
Marketing
</p>
I need to get the first links included in p tag and the second links included in p tag
so using page object I've added the following code:
links(:followees_category, :css => "#home-followees li.animate-in ul li[data-show-id] p.schedule-text a")
...
followees_category_elements.attribute("href")
the last row will give me both links : http://www.somesite2.com, http://www.somesite2.com
Unfortunately, I can't indicate in css :last/:first etc.
the second link can be gotten by changing css to :
#home-followees li.animate-in ul li[data-show-id] p.schedule-text a + a
but how can I get just the first links from such blocks?
Of course, I can get both links and work with every 2nd, but maybe there is an alternative solution?
You can use the css nth-of-type pseudo class to get elements based on their index (or relative position).
For example, a:nth-of-type(1) can be used to return all links that are the first line of their parent:
links(:followees_category, :css => "p.schedule-text a:nth-of-type(1)")
For the second links, you can do a:nth-of-type(2). Note that it is 1-based index.
links(:followees_category, :css => "p.schedule-text a:nth-of-type(2)")
For the first link, you can also do a:first-of-type:
links(:followees_category, :css => "p.schedule-text a:first-of-type")
If the second link is always the last link, you can also do a:last-of-type:
links(:followees_category, :css => "p.schedule-text a:last-of-type")
I would not recommend using css selectors like these, because they make your tests harder to read and more fragile.
But, whatever the selector is in the end, i would use Ruby's Enumerable methods to get the second links like this:
links.select.each_with_index {|_, i| i.odd? }

Resources