Im trying to extract email addresses from multiple websites, since the email addresses are on different positions on multiple websites I am trying to find (Ctrl+F) “@” to locate email. I want to select the whole email and copy it to excel respectively. Indicating UI element will not work as different websites have different UI. Is there any method/activities to copy the found email to excel?
- Open Browser:
- Use the “Open Browser” activity to open the website.
- Search for “@”:
- Use the “Type Into” activity to simulate pressing Ctrl + F.
- Type
@
to open the Find dialog.
- Find Position of “@”:
- Use the “Find Text Position” activity to locate the position of the “@” symbol.
- Store the result in a variable, let’s call it
emailPosition
.
- Extract Text:
- Use the “Get Text” activity to extract the email address using the position obtained in the previous step (
emailPosition
).
- Write to Excel:
- Use the “Excel Application Scope” activity to open your Excel file.
- Use the “Write Cell” activity to write the extracted email address to the desired cell.
- Read Range (Excel file path)
→ Output: dtWebsites
-
For Each Row (row In dtWebsites)
Open Browser (row(“WebsiteURL”).ToString)
Type Into (Ctrl + F)
Type Into (“@” + “[Enter]”)
Get Text (Output: emailText)- Write Cell (Excel file path, emailText, “Sheet1”, “B” + row.RowNumber.ToString)
Close Tab (if needed)
- Write Cell (Excel file path, emailText, “Sheet1”, “B” + row.RowNumber.ToString)
cheers…!
- Use “Read Range” activity to read the list of URLs from an Excel sheet.
- Use a “For Each Row” activity to iterate through each URL.
- Then use “Open Browser” activity to open the web page corresponding to the current URL.
- Use the “Get Text” or “Screen Scraping” activities to extract the entire text content of the web page.
- Use regular expressions to find and extract email addresses from the extracted text.
For example:
emailMatches = Regex.Matches(pageText, “\b[A-Za-z0-9._%±]+@[A-Za-z0-9.-]+.[A-Z|a-z]{2,}\b”)
- Write the extracted email addresses to an Excel sheet using the “Write Cell” or “Write Range” activity.
Hi,
You can also use below steps:
- Open Website
- Use Get Text or Screen Scraping to extract text and store it in websiteText variable
- Assign emailList = websiteText.Split(" “c).Where(Function(word) word.Contains(”@")).ToList()
- For Each emailAddress In emailList
Write the emailAddress to Excel using Write Cell or Write Range