Custom activity issues

Hi all , am trying to create open & maximize the browser in a single activity.
i attached code for ref:
using System;
using System.Activities;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using WebDriverManager.DriverConfigs.Impl;

namespace OpenandMaximizeBrowser
{
public class OpenandMaximazeChromeBrowser : CodeActivity
{
[Category(“Input”)]
[RequiredArgument]
public InArgument URL{ get; set; }

    protected override void Execute(CodeActivityContext context)
    {
        try
        {
            new WebDriverManager.DriverManager().SetUpDriver(new ChromeConfig());
            IWebDriver driver = new ChromeDriver();
            //this.driver = driver;
            driver.Navigate().GoToUrl(URL.Get(context));
            driver.Manage().Window.Maximize();

        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }

        // throw new NotImplementedException();
    }
}

}

i created dll for this , but facing error like :
System.IO.FileNotFoundException: Could not load file or assembly ‘WebDriver, Version=3.141.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. The system cannot find the file specified.
File name: ‘WebDriver, Version=3.141.0.0, Culture=neutral, PublicKeyToken=null’
at OpenandMaximizeBrowser.OpenandMaximazeChromeBrowser.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!

can anyone say me how to resolve this .
thanks in advance
:slight_smile:

Hey @naveen19

Hope you’re well.

Is there a reason why you’re using custom code instead of UiPath acitvities?

Hi @naveen19,

Is there a specific need for custom code? There is a maximize window activity already within UiPath Studio. The document page has an example you can download too.

1 Like

Hi , no reason at all just am learning. It’s has something on it think so.
So I have started using uipath activities it’s already handy one.

Thanks

Perfect, learning how to do it through custom code is a great way to understand how activities are built. There are a few ways to decompile existing activities and seeing how they are set up but it would require an intermediate level of understanding of how dlls are compiled.

1 Like