WWW::Selenium 'cant find element' - perl

I'm having trouble with WWW::Selenium finding an href.
Here is the HTML element I'm looking for.
Sell Products
Here is the Perl code I'm using.
$sel->click('//a[contains(#href, "/auctions?organization_id=2")]');
Here is the error that WWW::Selenium is outputting.
Error requesting http://localhost:4444/selenium-server/driver/:
ERROR: Element //a[contains(#href, "/auctions?organization_id=2")] not found
Any tips/help will be greatly appreciated.
EDIT
Adding the surrounding HTML to aid in the troubleshooting.
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children">
Sell Products
</li>
</ul>
<ul class="sub-menu">
<li class="menu-item menu-item-type-custom menu-item-object-custom">
Seller Dashboard
</li>
</ul>

Instead of using hard-coded sleep I would suggest using wait_for_element_present.
my $locator = q{//a[contains(#href, "/auctions?organization_id=2")]};
$sel->wait_for_element_present($locator, $timeout)
$sel->click($locator);

Related

Github Pages, Jekyll. How to define output page for posts?

I am new to github pages and am currently trying to build a blog for my Design Studies but can't seem to get my post to output to the correct pages.
Currently all posts are being posted on the home page but need to be displayed on their appropriate course pages.
https://angusharrison.github.io/Design/
https://github.com/AngusHarrison/Design
Here is my sidebar menu
<menu class="sidebar-menu">
<li class="menu-items"><a class="menu-links" href="{{site.baseurl}}/">Home</a></li>
<li class="menu-items"><a class="menu-links" href="{{site.baseurl}}/about/">About</a></li>
<li class="menu-items"><a class="menu-links" href="{{site.baseurl}}/INDN211/">INDN211</a></li>
<li class="menu-items"><a class="menu-links" href="{{site.baseurl}}/INDN241/">INDN241</a></li>
<li class="menu-items"><a class="menu-links" href="{{site.baseurl}}/INDN341/">INDN341</a></li>
</menu>
When creating a post i would like to be able to output the post to the desired Page e.g https://angusharrison.github.io/Design/INDN211/
Any help is greatly appreciated
I have checked your Github repository, and here are the results:
Instead of single fixed links you currently have in your sidebar.html like
<li class="menu-items"><a class="menu-links" href="{{site.baseurl}}/INDN211/">INDN211</a></li>
use this in your sidebar:
{% for post in site.posts %}
<li class="menu-items">
<a class="menu-links" href="{{ post.url }}">{{ post.title }}</a>
</li>
{% endfor %}
This loops over your posts in the root of your _posts folder and it is using the title from the front matter of each post. You could easily add something like linktext: anyvalue to the front matter of each post and use post.linktext instead of post.title in the loop as link name.
The post files should be named like 2020-02-02-anynameyoulike.md, remove the seconds(?) from your filenames. And, there should be no subfolders.
Additionally I removed this from your _config.yml, as your question is around posts, not collections, it seems that you don't need that:
permalink: ':title/'
collections:
INDN211
INDN241
INDN341
Optional, but I recommend to remove any collection: anyvalue and permalink: anyvalue from the frontmatter of your posts. You don't need them.
Result:
I recommend to read this page about posts https://jekyllrb.com/docs/posts/
as well as the rest of the Jekyll documentation :)

Can tinyMCE editor or Jsoup fix html markup errors?

I am using tinymce editor in my project. HTML markup generated by editor is parsed using Jsoup (v.1.7.2) and is used to generate pdf using Apache FOP.
When user uses features of editor itself it generates valid html markup but if some user uses tool to include source code from other source directly and let's say he enters,
<ul>
<ul>
<ul>
<li>
one
</li>
<li>
two
</li>
<li>
three
</li>
<li>
four
</li>
</ul>
</ul></ul>
the edior is not fixing markup to,
<ul>
<li>
one
</li>
<li>
two
</li>
<li>
three
</li>
<li>
four
</li>
</ul>
As per https://validator.w3.org/nu/#textarea
the first markup is not valid,
Error: Element ul not allowed as child of element ul in this context.
Is fixing html markup possible in tinymce editor or with Jsoup parser, If not any other approach?
You can try using JTidy,
Tidy tidy = new Tidy();
tidy.setXHTML(true);
final InputStream inputStream = new FileInputStream("input.html");
tidy.parse(inputStream, System.out);

How to write arabic in github README file?

I need to write arabic (rtl) language in README.md file in github.
So how could I do this?
You can't do this with markdown but you can surely do this with HTML.
<div dir="rtl">
## عنوان
### قائمة
<ul>
<li>١. البند 1</li>
<li>٢.البند 2</li>
<li>٣.البند 3</li>
</ul>
</div>
If just some parts of the document need to be right-to-left:
## <div dir="rtl">عنوان</div>
### <div dir="rtl">قائمة</div>
<div dir="rtl"><ul>
<li>١. البند 1</li>
<li>٢.البند 2</li>
<li>٣.البند 3</li>
</ul></div>
You could consider using ahmadajmi/markdown-arabic which includes a right-to-left markdown editor.
Online version is also available at arabicmarkdown.netlify.com

Microdata format for showing an event with multiple date/time

With Microdata, what is the best way to represent an event page with multiple date/time booking options? There will be occasions when the event page only has one booking option, i.e one set date/time, no alternative, does this require a different method?
<section>
<h1>Tennis Lessons</h1>
<ol>
<li>Book Tickets for
<time datetime="2001-05-15 19:00">May 15</time>
</li>
<li>Book Tickets for
<time datetime="2001-05-16 19:00">May 16</time>
</li>
<li>Book Tickets for
<time datetime="2001-05-17 19:00">May 17</time>
</li>
</ol>
</section>
Or is this the wrong way to approach it and the events are children of a product?
<section itemscope itemtype="http://schema.org/Product">
<h1 itemprop="name">Tennis Lessons</h1>
<ol>
<li itemscope itemtype="http://schema.org/Event">Book Tickets for
<time datetime="2001-05-15 19:00">May 15</time>
</li>
<li itemscope itemtype="http://schema.org/Event">Book Tickets for
<time datetime="2001-05-16 19:00">May 16</time>
</li>
<li itemscope itemtype="http://schema.org/Event">Book Tickets for
<time datetime="2001-05-17 19:00">May 17</time>
</li>
</ol>
</section>
In this case, on a booking confirmation page, it would then be correct to wrap the whole section in event Microdata as it then only has one possible date/time option?
Schema.org defines that an Event happens "at a certain time". So each lesson should be represented by its own Event item.
If you can book a lesson on your page, you may want to use the offers property and provide an Offer for each Event.
The nesting in your second snippet (Event items inside the Product item) has no influence on the Microdata (example). You have to use a property (within the itemprop attribute) if you want to connect Microdata items.
While you could use Product to represent the fact that you provide the service of tennis lessons, it seems that the Product type is missing a suitable property to reference an Event item. The typical solution would be to use both types, but Microdata is rather limited in that regard (it works better with RDFa).
If you want to provide data that is the same for all events, you could make use of the itemref attribute (instead of repeating it for each event).
So a basic structure could be this:
<section>
<h1>Tennis Lessons</h1>
<p itemprop="description" id="event-desc">…</p>
<ol>
<li itemscope itemtype="http://schema.org/Event" itemref="event-desc">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
</div>
</li>
<li itemscope itemtype="http://schema.org/Event" itemref="event-desc">
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
</div>
</li>
</ol>
</section>

Google RDFa breadcrumbs

I am currently trying to implement RDFa breadcrumbs to my webpages. I think that I am following the example for multiple breadcrumbs on one page correctly, however in the testing tool and search results the breadcrumbs are not processed as expected (are extracted, but the breadcrumbs are not displayed).
Can you plese give me a hint what am I doing wrong.
Thanks.
Page with the breadcrumbs
<div class="breadCrumb">
<span typeof="v:Breadcrumb">
Algoritmy.net >
<span rel="v:child">
<span typeof="v:Breadcrumb">
<a ref="v:url" property="v:title" href="/category/39974/Mathematics">Mathematics</a> >
<span rel="v:child">
<span typeof="v:Breadcrumb">
<a ref="v:url" property="v:title" href="/category/48669/Primality">Primality</a> >
<span rel="v:child">
<span typeof="v:Breadcrumb">
Rabin-Miller test
</span>
</span>
</span>
</span>
</span>
</span>
</span>
</div>
"ref" isn't a valid RDFa or HTML attribute, make sure you spell it right: rel.
ref="v:url" should be rel="v:url"