Inject CSS into the Web Page

Injects CSS Stylesheet into the web page.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary scripting language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

webInjectCss --stylesheet(String) (Boolean)=value


Use the Start Browser (webStart) command to start a browser or use the Find Internet Explorer Browser (findBrowser) command to attach the Microsoft Internet Explorer before using the Inject CSS into the Web Page (webInjectCss) command.

Input parameter

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Style Sheet stylesheet Required Text CSS style sheet to inject into the page.

Output parameter

Designer mode label Script mode name Accepted variable types Description
Value value Text, Number Returns true when injecting the CSS successfully, or false otherwise.


Use the Inject CSS into the Web Page (webInmjectCss) command for change the background collor.

defVar --name success --type Boolean
webStart --name browser --type "Chrome"
webNavigate --url ""
// The body of the web page is a change to black.
webInjectCss --stylesheet "body {\r\n    background: black;\r\n    color: #FFF;\r\n}" success=value
// Informs if the background color of the main page has changed.
logMessage --message "${success}" --type "Info"
webClose --name browser --leavebrowseropen


  • This command does not evaluate if the Stylesheet is applied or syntax is correct.