I'm currently searching Elements with keywords with:
doc.select("p:contains(keyword)").get(0);
But how can I find elements which contain two keywords?
I need something like:
doc.select("p:contains(keyword1 & keyword2).get(0);
Can someone give me a hint?
Below given statement can be used for multiple selectors.
doc.select("p:contains(keyword1):contains(keyword2)")
Related
I have trouble trying to use an array as elements of drop-down list. I tried to google it, but it only leaded me to the official document which list all the options, but my variables will dynamically change when you rerun the code. Thx in advance.
btw, I converted it to a list only because I saw one post saying a list works... but it doesn't work on my end...
Here's my simple code. The last line need some fix.
I'm trying to write an extension for vs-code that does the following:
I want to have each of the "XY-#" expressions in the comments of gtests to be highlighted and clickable when holding down ctrl. Each link should open the default browser with an url
https://website/<number>
e.g. for the first expression in the example https://website/1912603
/// #requirement XY-#1912603, XY-#1884770, XY-#1885273
TEST_P(SomeFixture, Foo)
{
SUCCEED();
}
So what I will probably need is
some kind of regex pattern matching
code highlighting based on the matched pattern
reaction to ctrl-key
Link creation with the parsed and stripped <number>
I've been looking around for a while but couldn't find any example extension with a similar usecase. Any one of you came across some good examples to look into?
Thanks in advance,
Flo
You have to use a registerDocumentLinkProvider
I need to create the element and then delete it. Is there a way to find the element by it's text after it was created?
The xpath of the element is //div[#id='mif-tree-6']/span/span[3].
You can use xpath for it for example. Like:
//div[#id='mif-tree-6']//span[contains(text(),'your_text_here')]
UPDATE
Please provide an example of your html. It is possible to find a parent of your element with xpath and after that to find all the childs. For example your html =
<div id='lol'>
<div>first_item</div>
<div>second_item</div>
<div>third_element</div>
</div>
You get an array of elements with xpath =
//div[contains(text(),'first_')]/../div
So you can do something like:
click | //div[contains(text(),'first_')]/../div[2]
BUT if there are a lot of brothers-elements to find by text of one sibling it will be necessary to use loop to get every of them.
Once again. If you will provide full information about what are you doing and an example of your html it will be much easier to suggest.
I am curious if it is possible to generate a list of keywords, a index if you will, for easy reference by doxygen ? I am not talking of list of classes etc. but specific words that are used as indexes.
This is possible but AFAIK only with the Latex/pdf output, with the command \addindex
See the manual.
If anybody knows a way to produce an index with the HTML, I would be very interested too.
xrefitem
With this you can create a page for each of your keywords. One example they already make an alias for:
\xrefitem todo "Todo" "Todo List"
You can add other aliases in your Doxygen file:
ALIASES += "reminder=\xrefitem reminders \"Reminder\" \"Reminders\""
Then in the code you can do something like:
\reminder Add the cool feature here.
And you'll get a Reminder page with the list of reminders on it.
I need to find any extra links and print them out. I started by doing:
get_xpath_count('//li/a')
and comparing it to the size of an array that holds the name of all the links for the sidebar. When the count is too high/low, I need to print out all the extra/missing links. I would like to make a list of the names so I can compare it to the array. I've tried a few things like get_text('//li/a'), which returns the name of the first. get_text('//li/a[1]) does the same, but any other index returns nothing.
Any ideas? Also, I need the name that's displayed on the link, not the actual href.
Edit* Also, i'm pretty new to selenium and Xpath. Please let me know if there's info I let out that is needed, or just any suggestions towards thew way I'm going about this.
I have been able to get this to work using CSS element locators. Since I use CSS selectors far more often than Xpath, I find it easier to always use them with Selenium as well.
$selenium->get_text("css=li a:nth-child(1)")
$selenium->get_text("css=li a:nth-child(2)")
$selenium->get_text("css=li a:nth-child(...)")
$selenium->get_text("css=li a:nth-child(n)")
Use:
(//li/a)[$someNumber]
this will get you the text of $someNumber-th //li/a in the XML document.
In order to know what values to use to substitute the $someNumber with, you need to know the total count of these elements:
count(//li/a)
This is in JAVA. You can use the same concept in perl
int totCountInPage=selenium.getXpathCount(//li/a);
for(int count=1;count<=totCountInPage;count++)
System.out.println(selenium.getText("xpath=//li[count]/a"));
This should print text inside the anchor links under all li tag.