- Überblick
- Kryptografie
- Datenbank
- Java
- Python
- WebAPI
- Versionshinweise
- Über das WebAPI-Aktivitätspaket
- Projektkompatibilität
- XML deserialisieren (Deserialize XML)
- XPath ausführen (Execute XPath)
- XML-Knotenattribute erhalten (Get XML Node Attributes)
- XML-Knoten erhalten (Get XML Nodes)
- JSON serialisieren
- Deserialize JSON
- JSON-Zusammenstellung deserialisieren (Deserialize Json Array)
- HTTP Request (legacy)
- HTTP-Anfrage (HTTP Request)
- SOAP-Anfrage (SOAP Request)
- Erstellen und Deserialisieren eines JSON-Arrays
- Eine XML-Datei erkennen und analysieren
- Lesen und Deserialisieren einer XML-Datei
- WebAPI-Spracherkennung
Entwickleraktivitäten
Im folgenden Beispiel wird erläutert, wie Aktivitäten wie Deserialize XML oder Execute XPath zum Deserialisieren und Analysieren einer XML-Datei verwendet werden. Diese Aktivitäten finden Sie im Paket UiPath.WebAPI.Activities .
Download and extract the archive with the project in this example and copy the folder MissingScreenshotSampleProject-ForTestPurposes to your project folder.
So kann der Automatisierungsprozess erstellt werden:
- Öffnen Sie Studio und erstellen Sie einen neuen Prozess.
- Ziehen Sie einen Sequence-Container in den Workflow-Designer.
-
Erstellen Sie die folgenden Variablen:
Variablenname Variablentyp Standardwert SelectedProjectPathString WorkflowXMLStringString WorkflowXMLXDokument ScreenshotAttributesObjekt
-
- Add a Select Folder activity inside the Sequence.
- In the Properties panel, add the variable
SelectedProjectPathin the SelectedFolder field.
- In the Properties panel, add the variable
- Fügen Sie eine For Each-Aktivität nach der Select Folder-Aktivität hinzu.
- Add the value
WorkflowFilein the ForEach field. - Add the expression
Directory.GetFiles(SelectedProjectPath, "*.xaml", SearchOption.AllDirectories)in the Values field.
- Add the value
- Add a Read Text File in the Body container of the For Each activity.
- Add the value
WorkflowFilein the FileName field. - In the Properties panel, add the variable
WorkflowXMLStringin the Content field.
- Add the value
- Fügen Sie die Aktivität Deserialize XML nach der Read Text File hinzu.
- Add the variable
WorkflowXMLStringin the XMLString field. - In the Properties panel, add the value
WorkflowXMLin the XMLDocument field.
- Add the variable
- Fügen Sie eine Execute XPath-Aktivität nach der Aktivität Deserialize XML hinzu.
- Add the value
WorkflowXMLin the Existing XML field. - Add the expression
"//@InformativeScreenshot"in the XPath Expression field. - In the Properties panel, add the variable
ScreenshotAttributesin the Result field.
- Add the value
- Fügen Sie eine For Each-Aktivität nach der Aktivität Execute XPath hinzu.
-
Add the value
Attributein the ForEach field. -
Add the expression
CType(ScreenshotAttributes, IEnumerable).Cast(Of XAttribute)in the Values field. -
Select the Body container of the activity and create the following variable:
Variablenname Variablentyp Standardwert ScreenshotFileExistsBoolescher
-
- Add a Log Message activity inside the Body container of the For Each activity.
- Fügen Sie den Ausdruck
"Looking for: " + SelectedProjectPath + "\.screenshots\" + Attribute.Value + ".png"in das Feld Nachricht ein.
- Fügen Sie den Ausdruck
- Fügen Sie eine Path Exists-Aktivität nach der Log Message-Aktivität hinzu.
- Select the File option from the Path File drop-down list.
- Add the expression
SelectedProjectPath + "\.screenshots\" + Attribute.Value + ".png"in the XPath Expression field.
- Fügen Sie eine If-Aktivität nach der Aktivität Path Exists hinzu.
- Fügen Sie den Ausdruck
Not ScreenshotFileExistsin das Feld Bedingung ein.
- Fügen Sie den Ausdruck
- Add a Log Message activity inside the Then field of the If activity.
-
Select the Warn option from the Level drop-down list.
-
Fügen Sie den Ausdruck
String.Format("Could not find the screenshot file {0}.png referenced by file {1}", Attribute.Value, WorkflowFile)in das Feld Nachricht ein.
-
- Führen Sie den Prozess aus. Wenn Sie dazu aufgefordert werden, wählen Sie den Ordner MissingScreenshotSampleProject-ForTestPurposes aus. Die XML-Workflow-Datei im Ordner wird gelesen und deserialisiert. Informationen zu Screenshots, auf die in der XAML verwiesen wird, werden verwendet, um gefundene und fehlende Screenshots im Ordner zu identifizieren und zu protokollieren.
Hier können Sie ein Beispiel herunterladen.