1. RPA Challenge - Dynamic Web Page - Anchor

Hey Budji,

Will you please give some hint for how you have completed in only 2 seconds

1 Like

1 Like

Main.xaml (43.1 KB)
Yes…Even I did it…After so much of Failure

1 Like

Hi there! New to Uipath forums so i thought I give this a try.
This is an unorthodox method of fulfilling this mission and maybe its not done yet?.
Ill do a proper one with some anchors in the future.

Basically, I click on the the unique name in front of a input field and TAB to the next one to fill it out.
Since i dont have Excel on this computer i just used a static data from the variables over and over again.
And due to the fact that im working on a potato, i had to include 3 seconds of delay to every form to give the website time to load.

Love to hear your thoughts :slight_smile:

Since i cant upload to the forums yet, just a screenshot :smirk:

Ps, Its 100% reliable (if you dont move the mouse) and 100% slow.

Thanks in advance,

Mike

2 Likes

I know I am late to post the solution, but basically planning to be more active on UiPath forum.

I have built this process and believe it is almost 100% stable.

Find my workflow attached below.

RPAChallange.xaml (34.8 KB)

2 Likes

@badita

Hello Mihai,
excellent :slightly_smiling_face:

Here another solution with Selenium and PowerShell:

#-Begin-----------------------------------------------------------------
#-
#- Checked with Google Chrome 86.0.4240.198 at 18.11.2020
#-
#-----------------------------------------------------------------------

#-Sub LoadSelenium------------------------------------------------------
Function LoadSelenium {
  $Script:Path = "E:\Program Files\Selenium";
  [Void][System.Reflection.Assembly]::LoadFrom("$Script:Path\WebDriver.dll");
  [Void][System.Reflection.Assembly]::LoadFrom("$Script:Path\WebDriver.Support.dll");
}

#-Sub Main--------------------------------------------------------------
Function Main() {

  $Options = New-Object OpenQA.Selenium.Chrome.ChromeOptions;
  $Options.BinaryLocation = "E:/Program Files/Google/Chrome/Application/chrome.exe";
  $Options.AddArguments("--window-size=1536,1024");
  #With the headless argument you can save approximately up to 30%
  #$Options.AddArguments("--window-size=1536,1024", "--headless");

  $Script:Driver = New-Object OpenQA.Selenium.Chrome.ChromeDriver($Script:Path, $Options);

  $Excel = New-Object -ComObject "Excel.Application";
  #$Excel.Visible = $True;
  $WorkBook = $Excel.Workbooks.Open("E:\Projects\Selenium\RPAChallenges.xlsx");
  $WorkSheet = $WorkBook.Sheets.Item("Sheet1");

  $baseURL = "http://rpachallenge.com/";
  $Script:Driver.Navigate().GoToUrl($baseURL); 
  [OpenQA.Selenium.Support.UI.WebDriverWait]$Wait = New-Object OpenQA.Selenium.Support.UI.WebDriverWait($driver, [System.TimeSpan]::FromSeconds(10));
  [Void]$Wait.Until([OpenQA.Selenium.Support.UI.ExpectedConditions]::ElementToBeClickable([OpenQA.Selenium.By]::XPath("//button[contains(text(),'Start')]")));
  $Script:Driver.FindElementByXPath("//button[contains(text(),'Start')]").Click();

  [Void]$Wait.Until([OpenQA.Selenium.Support.UI.ExpectedConditions]::ElementToBeClickable([OpenQA.Selenium.By]::Id("start")));
  $Script:Driver.FindElementById("start").Click();

  For($i = 2; $i -le 11; $i++) { #Row
    [Void]$Wait.Until([OpenQA.Selenium.Support.UI.ExpectedConditions]::ElementIsVisible([OpenQA.Selenium.By]::XPath("//input[@type='submit' and @value='Submit']")));

    $Script:Driver.FindElementByXPath("//label[text()='First Name']/parent::*/input[1]").SendKeys($WorkSheet.Cells.Item($i, 1).Value2);
    $Script:Driver.FindElementByXPath("//label[text()='Last Name']/parent::*/input[1]").SendKeys($WorkSheet.Cells.Item($i, 2).Value2);
    $Script:Driver.FindElementByXPath("//label[text()='Company Name']/parent::*/input[1]").SendKeys($WorkSheet.Cells.Item($i, 3).Value2);
    $Script:Driver.FindElementByXPath("//label[text()='Role in Company']/parent::*/input[1]").SendKeys($WorkSheet.Cells.Item($i, 4).Value2);
    $Script:Driver.FindElementByXPath("//label[text()='Address']/parent::*/input[1]").SendKeys($WorkSheet.Cells.Item($i, 5).Value2);
    $Script:Driver.FindElementByXPath("//label[text()='Email']/parent::*/input[1]").SendKeys($WorkSheet.Cells.Item($i, 6).Value2);
    $Script:Driver.FindElementByXPath("//label[text()='Phone Number']/parent::*/input[1]").SendKeys($WorkSheet.Cells.Item($i, 7).Value2);

    $Script:Driver.FindElementByXPath("//input[@type='submit' and @value='Submit']").Click();
  }

  $WorkBook.Close();
  $Excel.Quit()
  [Void][System.Runtime.Interopservices.Marshal]::ReleaseComObject($Excel);

  Start-Sleep -Seconds 10;

  $Script:driver.Close();
  $Script:driver.Quit();

}

#-Main------------------------------------------------------------------
LoadSelenium;
Main;

#-Error Routine---------------------------------------------------------
Trap {
  Write-Host "Fehler" $_.Exception.GetType().FullName `
    "in Zeile" $_.InvocationInfo.ScriptLineNumber `
    `r`n $_.Exception.Message;
}

#-End-------------------------------------------------------------------

Here a solution for Google Chrome and Microsoft Edge which uses instead Excel a CSV file.

Here the CSV file: RPAChallenges.zip (695 Bytes)

#-Begin-----------------------------------------------------------------
#-
#- Checked with Google Chrome 86.0.4240.198 at 18.11.2020
#- Checked with Microsoft Edge 87.0.664.41 at 18.11.2020
#-
#-----------------------------------------------------------------------

#-Sub LoadSelenium------------------------------------------------------
Function LoadSelenium {
  $Script:Path = "E:\Program Files\Selenium";
  [Void][System.Reflection.Assembly]::LoadFrom("$($Script:Path)\WebDriver.dll");
  [Void][System.Reflection.Assembly]::LoadFrom("$($Script:Path)\WebDriver.Support.dll");
  [Void][System.Reflection.Assembly]::LoadFrom("$($Script:Path)\Microsoft.Edge.SeleniumTools.dll");
}

#-Sub Main--------------------------------------------------------------
Function Main() {

  #-Chrome--------------------------------------------------------------
  $Options = New-Object OpenQA.Selenium.Chrome.ChromeOptions;
  $Options.BinaryLocation = "E:/Program Files/Google/Chrome/Application/chrome.exe";
  $Options.AddArguments("--window-size=1536,1024", "--headless");

  $Script:Driver = New-Object OpenQA.Selenium.Chrome.ChromeDriver($Script:Path, $Options);

  #-Edge----------------------------------------------------------------
  #$Options = New-Object Microsoft.Edge.SeleniumTools.EdgeOptions;
  #$Options.UseChromium = $True;
  #$Options.AddArgument("headless");

  #$Script:Driver = New-Object Microsoft.Edge.SeleniumTools.EdgeDriver($Options);
  #$Script:Driver.Manage().Window.Size = [System.Drawing.Size]::new(1536, 1024);

  $WorkSheet = Import-Csv -Delimiter ";" -Path "E:\Projects\Selenium\RPAChallenges.csv";

  $baseURL = "http://rpachallenge.com/";
  $Script:Driver.Navigate().GoToUrl($baseURL); 
  [OpenQA.Selenium.Support.UI.WebDriverWait]$Wait = New-Object OpenQA.Selenium.Support.UI.WebDriverWait($driver, [System.TimeSpan]::FromSeconds(10));
  [Void]$Wait.Until([OpenQA.Selenium.Support.UI.ExpectedConditions]::ElementToBeClickable([OpenQA.Selenium.By]::XPath("//button[contains(text(),'Start')]")));
  $Script:Driver.FindElementByXPath("//button[contains(text(),'Start')]").Click();

  ForEach($Line in $WorkSheet) { #Row
    [Void]$Wait.Until([OpenQA.Selenium.Support.UI.ExpectedConditions]::ElementIsVisible([OpenQA.Selenium.By]::XPath("//input[@type='submit' and @value='Submit']")));

    $Script:Driver.FindElementByXPath("//label[text()='First Name']/parent::*/input[1]").SendKeys($Line.'First Name');
    $Script:Driver.FindElementByXPath("//label[text()='Last Name']/parent::*/input[1]").SendKeys($Line.'Last Name');
    $Script:Driver.FindElementByXPath("//label[text()='Company Name']/parent::*/input[1]").SendKeys($Line.'Company Name');
    $Script:Driver.FindElementByXPath("//label[text()='Role in Company']/parent::*/input[1]").SendKeys($Line.'Role in Company');
    $Script:Driver.FindElementByXPath("//label[text()='Address']/parent::*/input[1]").SendKeys($Line.'Address');
    $Script:Driver.FindElementByXPath("//label[text()='Email']/parent::*/input[1]").SendKeys($Line.'Email');
    $Script:Driver.FindElementByXPath("//label[text()='Phone Number']/parent::*/input[1]").SendKeys($Line.'Phone Number');

    $Script:Driver.FindElementByXPath("//input[@type='submit' and @value='Submit']").Click();
  }

  [OpenQA.Selenium.Screenshot]$ScreenShot = $Script:Driver.GetScreenshot();
  $ScreenShot.SaveAsFile("E:\Projects\Selenium\RPAChallenges.jpg", [OpenQA.Selenium.ScreenshotImageFormat]::Jpeg);

  Start-Sleep -Seconds 5;

  $Script:Driver.Close();
  $Script:Driver.Quit();

}

#-Main------------------------------------------------------------------
LoadSelenium;
Main;

#-Error Routine---------------------------------------------------------
Trap {
  Write-Host "Fehler" $_.Exception.GetType().FullName `
    "in Zeile" $_.InvocationInfo.ScriptLineNumber `
    `r`n $_.Exception.Message;
}

#-End-------------------------------------------------------------------

The using of the CSV file saves approximately up to 8%.

Best regards
Stefan

5 Likes

@StefanSchnell
Haha, Showoff :stuck_out_tongue:

2 Likes

@StefanSchnell

it is amazing…!

2 Likes

Thanks brother… exactly looking for the same one :heart_eyes:

2 Likes

Default with default values for DelayAfter/DelayBefore, there is a delay of 500ms per field, Strajk has those set to 0.

2 Likes

I’ve just done this lesson.

Main.xaml (30.9 KB)

1 Like

Hi All, I have completed this challenge in one shot using Anchor Base activity.
I want a solution in which it takes a very less amount of time (may be one sec).
If anyone can help me, let me know… Cheers!

1 Like

Hi @ShaswatSinha

Welcome to our UiPath Forum :slight_smile:

If you go through this topic, there was someone who used inject js activity to do it super fast :slight_smile:

1 Like

I’m struggling trying to low it even more…

1 Like

I got it! :slight_smile:

4 Likes

how?

1 Like

First mark was using set text with parallel activity and no delays. Second the same but using JS injection instead of set texts.

Regards,
Adrian Vilaseco

3 Likes

Hi @Adrian_Vilaseco
Mind sharing the files so I can learn?

1 Like

Got It.

Attachment:
AutomationChallenge.zip (12.7 KB)

1 Like

Sorry for the delay. Please find it attached. RPAChallenge.zip (27.4 KB)

3 Likes