1. Home
  2. Opkey Help
  3. 9. Working with Function Libraries
  4. 9.8 Using Coded Function Library – Common Scenarios

9.8 Using Coded Function Library – Common Scenarios

Using Global Variables in CodedFunction: 

You can write your code in the User Code section for using Global Variables specified in the list, as shown below.

Once, your written code of using Global Variables has been compiled successfully, they are shown in the Compilation Result tab in the dockable panel as shown below.


To Take Driver Instance:

To get the current tool instance, this will be WebDriver in case of Selenium WebDriver or Selenium JS. Make sure that you have called the “OpenBrowser” keyword in your Test Case before using this Coded Function.

ClickOnElement with OpKey Web or ClickOnElement with WebDriver

Associating External Libraries:

You can associate external libraries with the Coded Function Library as shown below.

Using External Libraries in CodedFunction & Intellisense or CodeAssist of External Libraries in CodedFunction:

Giving Input parameters in CodedFunction & ORObject as in Input of CodedFunction

To Click Using Javascript on Selenium WebDriver

TypeText

To launch the Appium Web on Mobile Center

Now, you can create a Coded FL to setup driver object, use this Coded FL in place of LaunchApplication or LaunchChrome or LaunchSafari like keywords. Thus, it will launch the Appium plugin to handle web view of application.

To launch the Appium App on Mobile Center

Now, you can create a Coded FL to setup driver object, use this Coded FL in place of LaunchApplication or LaunchChrome or LaunchSafari like keywords. It will launch the Appium plugin to handle native view of the application.

Was this article helpful to you? Yes No