How to use regular expressions in Selenium?
Submitted by: AdministratorRegular expressions in Selenium IDE can be used with the keyword - regexp: as a prefix to the value and patterns needs to be included for the expected values.
For example if you want to use the regular expression for a command
Command: verifyText
Target: //font/font/b/font[1]
Value: Flight Confirmation # 2011-05-02451
in the above example Flight Confirmation is continuously changing each time you run the test case. So this can be writtenwith a regular expression as mentioned below
Command: verifyText
Target: //font/font/b/font[1]
Value: regexp:Flight Confirmation # [0-9]{4}-[0-9]{2}-[0-9]{5,10}
Submitted by: Administrator
For example if you want to use the regular expression for a command
Command: verifyText
Target: //font/font/b/font[1]
Value: Flight Confirmation # 2011-05-02451
in the above example Flight Confirmation is continuously changing each time you run the test case. So this can be writtenwith a regular expression as mentioned below
Command: verifyText
Target: //font/font/b/font[1]
Value: regexp:Flight Confirmation # [0-9]{4}-[0-9]{2}-[0-9]{5,10}
Submitted by: Administrator
Read Online Selenium Job Interview Questions And Answers
Top Selenium Questions
☺ | Which is the command used for displaying the values of a variable |
☺ | Can you please explain Selenium vs Imacros? |
☺ | Tell me what is the difference between an assert and a verify with Selenium |
☺ | Explain if a Selenium function requires a script argument, what would that |
☺ | What is Selenium WebDriver or Google WebDriver or Selenium 2.0? |
Top Software Testing Categories
☺ | Selenium Interview Questions. |
☺ | Soft Skills Interview Questions. |
☺ | Automation Testing Interview Questions. |
☺ | Software Quality Control Interview Questions. |
☺ | Testing Estimation Interview Questions. |