- Vue d'ensemble (Overview)
- Cryptographie
- Base de donnés
- Java
- Python
- APIweb
Activités du développeur.
L’exemple suivant explique comment utiliser les activités telles que Désérialiser XML ou Exécuter XPath pour désérialiser et analyser un fichier XML. Vous pouvez retrouver ces activités dans le package UiPath.WebAPI.Activities .
Download and extract the archive with the project in this example and copy the folder MissingScreenshotSampleProject-ForTestPurposes to your project folder.
Voici comment le processus d'automatisation peut être créé :
- Ouvrez Studio et démarrez un nouveau Processus.
- Faites glisser un conteneur Séquence vers le concepteur de workflow.
-
Créez les variables suivantes :
Nom de variable Types de variables Valeur par défaut SelectedProjectPathChaîne de caractères (string) WorkflowXMLStringChaîne de caractères (string) WorkflowXMLDocumentX ScreenshotAttributesObjet
-
- 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
- Ajoutez une activité Affecter (Assign) après l’activité Sélectionner un dossier (Select Folder).
- 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
- Ajoutez une activité Désérialiser XML (Deserialize XML) sous l’activité Lire le fichier texte (Read Text File).
- Add the variable
WorkflowXMLStringin the XMLString field. - In the Properties panel, add the value
WorkflowXMLin the XMLDocument field.
- Add the variable
- Ajoutez une activité Exécuter XPath (Execute XPath) après l’activité Deserialize XML (Désérialiser XML).
- 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
- Ajouter une activité Pour chaque (For Each) sous l’activité Exécuter XPath (Execute XPath) précédente.
-
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:
Nom de variable Types de variables Valeur par défaut ScreenshotFileExistsBooléen
-
- Add a Log Message activity inside the Body container of the For Each activity.
- Ajoutez l’expression
"Looking for: " + SelectedProjectPath + "\.screenshots\" + Attribute.Value + ".png"dans le champ Message.
- Ajoutez l’expression
- Ajoutez une activité Le chemin d’accès existe (Path Exists) sous l’activité Message du journal (Log Message).
- Select the File option from the Path File drop-down list.
- Add the expression
SelectedProjectPath + "\.screenshots\" + Attribute.Value + ".png"in the XPath Expression field.
- Ajoutez une activité Si (If) après l’activité Le chemin d’accès existe (Text Exists).
- Ajoutez l’expression
Not ScreenshotFileExistsdans le champ Condition.
- Ajoutez l’expression
- Add a Log Message activity inside the Then field of the If activity.
-
Select the Warn option from the Level drop-down list.
-
Ajoutez l’expression
String.Format("Could not find the screenshot file {0}.png referenced by file {1}", Attribute.Value, WorkflowFile)dans le champ Message.
-
- Exécutez le processus. Lorsque vous y êtes invité, sélectionnez le dossier MissingScreenshotSampleProject-ForTestPurposes. Le fichier de workflow XML dans le dossier est lu et désérialisé. Les informations sur les captures d’écran référencées dans le fichier XAML sont utilisées pour identifier et consigner les captures d’écran trouvées et manquantes dans le dossier.
Ici, vous pouvez télécharger un exemple.