Problem with HTML file

Hello,
I want to check is text exist in my HTML file and i have problem with it.
I starting from START PROCESS and opening HTML file with notepad++
but i need to read all the data from this file and check that it contains a specific text like:

" < div cl ass=" paragraph_text">
< s pa n>Potwierdzono ilosc</sp an>
< spa n style=" font-weight: bold;">Wieksza</sp an>"

How can i do that?
(i needed to put several spaces becouse part of my text was not visible)

@Ripper
welcome to the forum

in general we use the read text file activity to get the text

for the check we have following options:

  • string processing functions
  • regex
  • XML processing functions and possibilities

I want to check is text exist in my HTML file
Are you looking for a particualr text token or only if file is not empty?

let us know if you need further help

Hello PPR,
i want to know that the specified text is in the entire file.
But if i use TEXT EXISTS activity and paste my searched text into it, i have an error “end of expression expected”

@Ripper

  • use read text file activity and readin the html file
  • create a variable for the text to search (double quote the " - this could be the current issue with the validation message
    OR readin the search text from a seperate text file

checking if the text is present can be done e.g. with
strYourHTMLText.Contains(YourSearcgText)

quotes in strings are managed as by following
grafik

1 Like

Its works :slight_smile:
One more question:
It is possible to use just a part of filename in READ FILE activity?
Example:
Full file name: 123File.html
Part : *File.html

Becouse every time my file changing number in name, but of course all time is just one file in directory.

@Ripper
maybe it is solved with combining it with following statement:
Directory.GetFiles(“YourPath”,"*.html")

with a few checks the retrieved filename can be passed to the read text activity

Directory.GetFiles(“C:\RPA\test\EDMTEMP”,"*.html").ToString

image

Read Text File: One or more errors occurred.

@Ripper
this is not working due Directory.GetFiles is retruning an array of String containing the found filepaths

As mentioned:

with a few checks the retrieved filename can be passed to the read text activity

just check if 1 or more files are found and pass it eg. by using an index
YourGetFilesResultVariable(0) for the first item

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.