inserting text inside a node katalon - text

I am trying to insert a text inside a P tag dynamically.
WebUI.waitForElementPresent(findTestObject('Page_Mthode Swing - EidosMedia QA_m (1)/span_Insert Headline Here'), 10)
WebUI.setText(findTestObject('Page_Mthode Swing - EidosMedia QA_m (1)/span_Insert Headline Here'), 'Testing Katalon')
span_Insert Headline Here - xpath: id("editor_1")/eom-content/div[#class="xsm-doc"]/div[#class="xsm-story"]/div[#class="xsm-grouphead emxed-ct-headline emxed-contentitem-wrapper"]/div[#class="xsm-headline"]/p[#class="xsm-p"]
desired output: p tag Testing /p
Can anyone please help me?

Related

How to get srcset from img tag using scrapy python

So I'm extracting some info from product pages and I want to get the img link from the img tag but it has a srcset with multiple links and I don't know how to get its data using scrapy:
The HTML:
<img width="768" height="1152" alt="Top com brilho - Preto - SENHORA | H&M PT" class="Top com brilho - Preto - SENHORA | H&M PT" srcset="//lp2.hm.com/hmgoepprod?set=quality[79],source[/e4/e9/e4e96ab4841af66083ba521c17c1c18a8e300426.jpg],origin[dam],category[ladies_tops_vests],type[DESCRIPTIVESTILLLIFE],res[y],hmver[1]&call=url[file:/product/main] 396w,
//lp2.hm.com/hmgoepprod?set=quality[79],source[/e4/e9/e4e96ab4841af66083ba521c17c1c18a8e300426.jpg],origin[dam],category[ladies_tops_vests],type[DESCRIPTIVESTILLLIFE],res[w],hmver[1]&call=url[file:/product/main] 564w,
//lp2.hm.com/hmgoepprod?set=quality[79],source[/e4/e9/e4e96ab4841af66083ba521c17c1c18a8e300426.jpg],origin[dam],category[ladies_tops_vests],type[DESCRIPTIVESTILLLIFE],res[s],hmver[1]&call=url[file:/product/main] 657w,
//lp2.hm.com/hmgoepprod?set=quality[79],source[/e4/e9/e4e96ab4841af66083ba521c17c1c18a8e300426.jpg],origin[dam],category[ladies_tops_vests],type[DESCRIPTIVESTILLLIFE],res[m],hmver[1]&call=url[file:/product/main] 820w" sizes="(max-width: 767px) 100vw, 50vw" src="//lp2.hm.com/hmgoepprod?set=quality[79],source[/e4/e9/e4e96ab4841af66083ba521c17c1c18a8e300426.jpg],origin[dam],category[ladies_tops_vests],type[DESCRIPTIVESTILLLIFE],res[m],hmver[1]&call=url[file:/product/main]">
Is there a way to get all the links or maybe make a list with all links?
Check and see if the website uses JSON or Javascript that will affect how scrapy handles the data. Click inspect elements in the website and try and to see if it selects all of the image links
//div[#class = 'product-detail-main-image-container']/img/#src
I managed to make it work with the following code:
self.img = response.xpath('/html/body/main/div[2]/div[2]/div[1]/figure[1]/div/img/#srcset').get()
self.img = self.img.split('\r')[0][2:]
self.img, x = self.img.split(' ')

Getting the q-item-label text

I have this code using Quasar/VueJS. What I want to do is update the dropdown text label (keyDropDownLabel) based on the selected <q-item-label>.
So in this example below, I want the newLabelGoesHere part to be Key 1/2/3, depending on which was clicked.
<q-btn-dropdown stretch flat :label="keyDropDownLabel">
<q-list>
<q-item v-for="n in 3" :key="`x.${n}`" clickable v-close-popup tabindex="0">
<q-item-section #click="keyDropDownLabel = 'newLabelGoesHere'">
<q-item-label>Key {{ n }}</q-item-label>
<q-item-label caption>1234567890</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
Anyone help please??
Just modify the q-item-section click method like below:
<q-item-section #click="keyDropDownLabel('Key'+n)">

I need help in Python with displaying the contents of a 2D Set into a Tkinter Textbox

Disclaimer: I have only begun to learn about Python. I took a crash course just to learn the very basics about a month ago and the rest of my efforts to learn have all been research thru Google and looking at solutions here in Stack Overflow.
I am trying to create an application that will read all PDF files stored in a folder and extract their filenames, page numbers, and the contents of the first page, and store this information into a 2D set. Once this is done, the application will create a tkinter GUI with 2 listboxes and 1 text box.
The application should display the PDF filenames in the first listbox, and the corresponding page numbers of each file in the second listbox. Both listboxes are synched in scrolling.
The text box should display the text contents on the first page of the PDF.
What I want to happen is that each time I click a PDF filename in the first listbox with the mouse or with up or down arrow keys, the application should display the contents of the first page of the selected file in the text box.
This is how my GUI looks and how it should function
https://i.stack.imgur.com/xrkvo.jpg
I have been successful in all other requirements so far except the part where when I select a filename in the first listbox, the contents of the first page of the PDF should be displayed in the text box.
Here is my code for populating the listboxes and text box. The contents of my 2D set pdfFiles is [['PDF1 filename', 'PDF1 total pages', 'PDF1 text content of first page'], ['PDF2 filename', 'PDF2 total pages', 'PDF2 text content of first page'], ... etc.
===========Setting the Listboxes and Textbox=========
scrollbar = Scrollbar(list_2)
scrollbar.pack(side=RIGHT, fill=Y)
list_1.config(yscrollcommand=scrollbar.set)
list_1.bind("<MouseWheel>", scrolllistbox2)
list_2.config(yscrollcommand=scrollbar.set)
list_2.bind("<MouseWheel>", scrolllistbox1)
txt_3 = tk.Text(my_window, font='Arial 10', wrap=WORD)
txt_3.place(relx=0.5, rely=0.12, relwidth=0.472, relheight=0.86)
scrollbar = Scrollbar(txt_3)
scrollbar.pack(side=RIGHT, fill=Y)
list_1.bind("<<ListboxSelect>>", CurSelect)
============Populating the Listboxes with the content of the 2D Set===
i = 0
while i < count:
list_1.insert(tk.END, pdfFiles[i][0])
list_2.insert(tk.END, pdfFiles[i][1])
i = i + 1
============Here is my code for CurSelect function========
def CurSelect(evt):
values = [list_1.get(idx) for idx in list_1.curselection()]
print(", ".join(values)) ????
========================
The print command above is just my test command to show that I have successfully extracted the selected item in the listbox. What I need now is to somehow link that information to its corresponding page content in my 2D list and display it in the text box.
Something like:
1) select the filename in the listbox
2) link the selected filename to the filenames stored in the pdfFilename 2D set
3) once filename is found, identify the corresponding text of the first page
4) display the text of the first page of the selected file in the text box
I hope I am making sense. Please help.
You don't need much to finish it. You just need some small things:
1. Get the selected item of your listbox:
selected_indexes = list_1.curselection()
first_selected = selected_indexes[0] # it's possible to select multiple items
2. Get the corresponding PDF text:
pdf_text = pdfFiles[first_selected][2]
3. Change the text of your Text widget: (from https://stackoverflow.com/a/20908371/8733066)
txt_3.delete("1.0", tk.END)
txt_3.insert(tk.END, pdf_text)
so replace your CurSelect(evt) method with this:
def CurSelect(evt):
selected_indexes = list_1.curselection()
first_selected = selected_indexes[0]
pdf_text = pdfFiles[first_selected][2]
txt_3.delete("1.0", tk.END)
txt_3.insert(tk.END, pdf_text)

Unable to render footer using Asciidoctor pdf

I'm trying to render a document with asciidoctor-pdf which has a footer with chapter title/page number. From the examples found so far I have come with this:
= Title of the book
:notitle:
:toc: left
:toclevels: 8
:sectnums:
:sectnumlevels: 8
:source-highlighter: coderay
:icons: font
:front-cover-image: pic.jpg
footer:
height: 0.5in
line_height: 1
recto_content:
right: '{chapter-title} | *{page-number}*'
verso_content:
left: '*{page-number}* | {chapter-title}
== Chapter 1
However it does not produce the footer. I've tried both using the footer and the :footer top directive.
Any help what could be wrong?
If you want to style your pdfs you can not put your settings in the adoc-file. You have to use pdf-theming. You find a long explanation here
A very short summary looks like
create a file basic-theme.yml in directory themes (example for basic-theme.yml)
put your footer settings basic-theme.yml
use your styles asciidoctor-pdf -a pdf-stylesdir=themes -a pdf-style=basic Details

How can I compile a list of unique image filenames in a set of html files?

I have ~3,600 html files with a ton of image tags in them. I'd like to be able to capture all the src attribute values used in these files and aggregate them into a text file where I can then remove duplicates and see how many unique image filenames there are overall.
I use BBEdit and I can easily use regex and multi-file search to find all the image references (18,673), but I don't want to replace them with anything -- instead, I want to capture them from the BBEdit search results 'Notes' and push them into another file.
Is this something that can be AppleScripted? Or are there other means to the same end that would be appropriate?
You've got a tall task there because there's many parts of this you have to solve. To give you a start, here's some advice on reading one html file and putting all the src images in an applescript list. You have to do much more than that but this is a beginning.
First you can read a html file into applescript as regular text. Something like this will get the text of one html file...
set theFile to choose file
set htmlText to read theFile
Once you have the text into applescript you could use text item delimiters to grab the src images. Here's an example. It should work no matter how complex the html code...
set htmlText to "<img src=\"smiley.gif\" alt=\"Smiley face\" height=\"42\" width=\"42\" />
<img src=\"smiley.gif\" alt=\"Smiley face\" height=\"42\" width=\"42\" />
<img src=\"smiley.gif\" alt=\"Smiley face\" height=\"42\" width=\"42\" />"
set text item delimiters to "src=\""
set a to text items of htmlText
if (count of a) is less than 2 then return
set imageList to {}
set text item delimiters to "\""
repeat with i from 2 to count of a
set thisImage to first text item of (item i of a)
set end of imageList to thisImage
end repeat
set text item delimiters to ""
return imageList
I hope that helps!

Resources