Watir Scraping Rails - Set date of input that exists? but is not present - ruby-on-rails

Good morning everybody,
I have been trying to scrape this page: https://www.aftnet.be/MyAFT/Competitions/Tournaments but I have run into some problems.
Collapsed Search Form
Search Form
If you click > Recherche détaillée , a search form appears along with the OK button to run it. The markup of the page is not that great but with the following I manage to run the search with no specific search criterion set:
browser.button(text: 'OK').fire_event "onclick"
However for my current use I would need to be able to specify the date range:
browser.input(id: 'periodStartDate').exists? --> TRUE
browser.input(id: 'periodEndDate').exists? --> TRUE
browser.input(id: 'periodStartDate').present? --> FALSE
browser.input(id: 'periodEndDate').present? --> FALSE
I have tried setting the value of those using browser.input(id: 'periodStartDate').value ='03/06/2021' but to no avail.
I also tried : browser.text_field(id: 'periodStartDate').set('03/06/2021') but that also did not work.
I have come to wonder whether it was because it was not possible to set a value of an element that exists but is not present so I tried to click > Recherche détaillée with Watir to collapse the search form and then have the search fields present. But I also haven't managed to make it work using : browser.link(text: 'Recherche détaillée').click
What I truly do not understand is that:
browser.link(text: 'Recherche détaillée').exists? --> TRUE
browser.link(text: 'Recherche détaillée').present? --> FALSE
Watir basically seems to not see that anchor present when it is visible when opening the page by default.
At this stage I don't know what else to try and that's why I'm here hoping someone can help me!
Thanks in advance!

Related

How to get pseudo elements in WebdriverIO+Appium

I want to get a value (content) from the CSS of a pseudo element (::before) while inside a test made using WDIO and Appium for an Android hybrid app because the designer has stored the current responsive-design state there. So my tests would know which layout (elements) to expect.
Multiple answers to related questions (1; 2; 3) indicated that using .getComputedStyle() might be the only solution. But this does not seem to work in my tests. The error is window is not defined for window.getComputedStyle(...) or document is not defined if I use document.defaultView.getComputedStyle(...). Also selectors themselves can't address pseudo-elements it seems.
Example of one of my many attempts:
document.defaultView.getComputedStyle($('body'),'::before').getPropertyValue('content')
Question: Do I need to somehow import window or document to my test? Is there some other way to get window or document from inside the test?
Ultimately: how can I get the content value of ::before of the <body> of a hybrid Android app?
Thanks to Jeremy Schneider (#YmerejRedienhcs) & Erwin Heitzman (#erwinheitzman) for help!
One solution is to use the execute function:
let contentMode = browser.execute(() => {
let style = document.defaultView.getComputedStyle(document.querySelector('body'),'::before');
return style.getPropertyValue('content')
});
Alternatively maybe something could also be done with getHTML.

Input Control Parameters not passing in Jaspersoft Reference Hyperlink to Dashboard

I have a jaspersoft report (line chart built in studio), and I want the data series in the chart to be hyperlinks that drilldown to open a dashboard.
Based on this wiki page I was able to create Reference hyperlinks so that clicking on any data series in the chart opens the correct dashboard. But I cannot get the Input Control parameters to pass correctly.
The URL when I load my dashboard directly from the repository (not by clicking hyperlinks in my line chart report) is
http://ddevrpt:8080/jasperserver-pro/dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile
The URL generated when i do not include input controls in my hyperlink reference expression is the same:
http://ddevrpt:8080/jasperserver-pro/dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile
JRXML:
<itemHyperlink hyperlinkType="Reference">
<hyperlinkReferenceExpression><![CDATA["./dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile"]]></hyperlinkReferenceExpression>
</itemHyperlink>
The URL generated when i do include Input Control parameter values is different, but still loads the dashboard empty (without passing the parameter values):
http://ddevrpt:8080/jasperserver-pro/dashboard/viewer.html?hidden_WellConcatenated_0=49005478.1:%20DILTS%2044-15%20TH&hidden_OccurrenceDate_1=2015-09-28%2000:00:00.0&hidden_OccurrenceDate_2=2015-10-05%2000:00:00.0#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile
JRXML:
<itemHyperlink hyperlinkType="Reference">
<hyperlinkReferenceExpression><![CDATA["./dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile"+"&hidden_WellConcatenated_0=" + $V{WellConcatenated_0} + "&hidden_OccurrenceDate_1=" + $P{RecordDate_0_1} + "&hidden_OccurrenceDate_2=" + $P{TimeStampMinusOneWeek}]]></hyperlinkReferenceExpression>
</itemHyperlink>
I know I am naming the input controls correctly because if i change my link type to report execution and link to a simple report using those input controls the proper report opens and the input control values are passed correctly.
I would also appreciate if anyone has other references they can point me to for drilling down TO a dashboard from a report.
I'm working with 6.3 and was able to resolve the issue with a small modification to the HyperlinkReferenceExpression syntax.
Specifically, I removed the "_hidden" before the input control resource IDs:
HyperlinkReferenceExpression:
original syntax:
"./dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile"
+"&hidden_WellConcatenated_0=" + $V{WellConcatenated_0}
+"&hidden_OccurrenceDate_1=" + $P{RecordDate_0_1}
+"&hidden_OccurrenceDate_2=" + $P{TimeStampMinusOneWeek}
modified syntax:
"./dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile"
+"&WellConcatenated_0=" + $V{WellConcatenated_0}
+"&OccurrenceDate_1=" +$P{RecordDate_0_1}
+"&OccurrenceDate_2=" + $P{TimeStampMinusOneWeek}
I'm assuming you're running 6.4.0. I'm not sure that approach is still valid.
You will likely need to register a custom hyperlink handler in your report in order to drill-down to a Dashboard. See here for more details: http://community.jaspersoft.com/wiki/how-use-custom-hyperlink-handler-dashboard-jasperreports-server
And here: http://www.helicaltech.com/use-custom-hyperlink-handler-with-a-dashboard-in-jasperreports-server/
Let me know if that works for you on 6.4.0!
My solution is a bad solution., but it worked for me.
In my Dataset - query I used the following:
Select p.printer_name, p.display_name, $P{start_date_1} as start_date_param, ....
Then, use the start_date_param as a field in the hyperlink.

How to display pdf in a WebView in terms of UI and UX - iOS Swift

Brief about the app: The app parses html documents and load it in the app as a web view.
In the iOS app I like to show PDF files. There is a structure XML that would contain the whole structure.
Case 1: For a simple PDF file it would look like the following in the structure.xml
<node id="Nc13d37aa" node_id="82cd790d-e5f0-4ee6-a26c-a6e400af8541" type="publication" default="TEST_Pub" secured="false">
<language name="en-GB" path="X-BIKE-401/en-GB/publications/TEST_Pub-003.00.pdf">
<title>(Test-)Publication</title>
</language>
</node>
Case 2: In a more complex scenario one publication might contain a so called ATI's(Additional technical information) This would look like this:
<node id="Nd747c4dc" node_id="b4528fb8-c615-4b96-945d-a5af009325f2" type="publication" default="TEST_Pub_ATI" secured="false">
<language name="en-GB" path="X-BIKE-401/en-GB/publications/TEST_Pub_ATI-003.00.pdf">
<title>(Test-)Publication with ATI</title>
<atis>
<ati id="ati584a41ee" internal_id="af720ef4-5238-4fb4-ba8b-a5ae00debfae" code="Test_ATI" type="Service Letter" required="false" issuecode="Test_ATI_03" issuenumber="3" revisionnumber="0" href="X-BIKE-401\en-GB\ati\Test_ATI-003.00.pdf">(Test-)ATI</ati>
</atis>
</language>
</node>
The idea here is, that we have additional legacy documents accompanying a legacy publication. The idea here would be, that we show the normal legacy publication, but have an additional area in the view, that indicates the user, that there ARE ATIs, and a way for him to view the ATIs - but also get back to the original publication. An ATI is usually some information
Case 3: There is also the case, that one or many ATIs are mandatory.
This means, that the user needs to read & confirm those first, before he can read the actual publication. This will be like:
<node id="N5a3c00f" node_id="09fe8d7b-a95d-4da8-bf06-a5af00933ddc" type="publication" default="TEST_Pub_mATI" secured="false">
<language name="en-GB" path="X-BIKE-401/en-GB/publications/TEST_Pub_mATI-003.00.pdf">
<title>(Test-)Publication with MANDATORY ATI</title>
<atis>
<ati id="ati35c8ee0e" internal_id="60dfaa70-f017-44ea-9190-a5ae00df2494" code="Test_ATI_MAND1" type="Service Bulletin" required="true" issuecode="Test_mATI_03" issuenumber="3" revisionnumber="0" href="X-BIKE-401\en-GB\ati\Test_ATI_MAND1-003.00.pdf">(Test-)ATI1 (MANDATORY)</ati>
<ati id="atic771b1b6" internal_id="d1cffa4b-b1be-4bbb-8dc0-a743010cf246" code="Test_ATI_MAND2" type="Service Bulletin" required="true" issuecode="Test_mATI2_01" issuenumber="1" revisionnumber="0" href="X-BIKE-401\en-GB\ati\Test_ATI_MAND2-001.00.pdf">(Test-)ATI2 (MANDATORY)</ati>
</atis>
</language>
</node>
You can see, that two have the #required set to "true".
In this case we need to first show the first ATI, request the user to "confirm" somewhere that he read it. move on to the next required ATI and conform this as well. and once he has confirmed all the ATIs, he can view the publication itself.
Still he needs to be able to reopen the ATIs (similar to the previous point) and look them up again - without confirmation again.
The user needs to reconfirm, once the publication is closed.
Question: For case 2 & 3, how would this might look like? a mockup of it how would it be? Ideally a proposed solution best in terms of UI and UX.
I can suggest you this way , it may solve your question :
CASE 1 :
Simply Take a UIWebView and show PDF url link , then WebView will render it perfectly .
CASE 2 :
In case 2 you are first showing the case 1 where you show simple PDF and showing it by rendering the web view but then this PDF has extra information called ATI that we need to show this somehow on the web view. So for example a button that when you click on it it will show the extra information maybe in a pop up and then there should be a navigation back to the original PDF
CASE 3:
Use some Image Flipper library to show multiple pdf doc in which you can show some sort of info to acknowledge the user about there are more than one doc is there for navigation .
For Flipper follow this library : https://cocoapods.org/pods/DJKFlipper
Thanks.

How Automatically On "Content Blocker" Extension in Safari section?

I am creating an Ad Blocker. I am just trying to Automatically on safari extension of "Content Blocker". I went through examples but did't found any solution. Is there any way to "ON" extension or manually we have to start it?
On iOS, Safari Content Blockers are disabled by default.
There is no way to automatically enable them from your app. You must instruct the user to:
Open the Settings app.
Go to Safari > Content Blockers.
Toggle on your Content Blocker extension.
On macOS (as of 10.12), a similar rule applies: Content Blocker extensions (bundled with your app) are disabled by default, and must be toggled on by the user in Safari Preferences > Extensions.
Assuming you want to test your "personal AdBlock program", first prepare a dummy HTML, with this line <div class="ads">hello</div>,
next apply your "personal AdBlock program", assuming it is JavaScript/CSS based and not proxy-like, you either hide, or remove the element (Node) from the DOM.
for example:
document.querySelector('div[class*="ads"]') -- this is nice and (very) generic way to find the element.
this is how to hide "the ads"
document.querySelector('div[class*="ads"]').style.display="none";
or, to make it stronger, related to other rules on the page, make it a local style + important notifier: document.querySelector('div[class*="ads"]').style.cssText="display:none !important;" ;
you can also remove the element (Node) from the DOM:
var e = document.querySelector('div[class*="ads"]') follow by:
e.parentNode.removeChild(e);
now, you probably want to see that "YOUR ADBLOCK" worked,
later (after the page has loaded, and your javascript code runned) type:
console.log(null === document.querySelector('div[class*="ads"]') ? "removed(success)" : "still here(failed)")
note that for this example (to make things simple) I assume there is only one div with that class in the page (avoiding loops :) ).
if you've just going to hide the element, you should query its current (most updated) style-condition, using a native method exist under window:
console.log("none" === window.getComputedStyle(document.querySelector('div[class*="ads"]')) ? "hidden(success)" : "still here(failed)")
Enjoy!

Ng-Tag-input minLength not set property

I use this library in my ionic project (Cross platform mobile application), And I try to set minLength : 1 but it takes default value (i.e. 3). How can i achieve this?
Set the min-length="1" property to the <auto-complete> instead of <tags-input> to get suggestions for every character.
like this:
<tags-input ng-model="vm.tags">
<auto-complete source="vm.loadTags($query)"
min-length="1"
highlightMatchedText="true">
</auto-complete>
</tags-input>
Even I spent a few hours figuring out how to do it, it later flashed me when I read the documentation of autoComplete again.
http://mbenford.github.io/ngTagsInput/documentation/api#autoComplete

Resources