Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15990

How to use “action” in vb.net using selenium webdriver?

$
0
0
I am using selenium webdriver to automate chrome in VB.net (2019 version). I want to send some keystrokes to chrome using action. I have tried the following code

Dim driver As IWebDriver
driver = New ChromeDriver
driver.Navigate().GoToUrl("https://example.com/")
Dim action1 As Action = New Action(driver)
and it is showing me following error at "New action(driver)" location "Delegate "action: requires as "address of" expression or Lambda expression..."

I have imported the following references

Imports SileniumTest
Imports OpenQA.Selenium
Imports OpenQA.Selenium.Firefox
Imports OpenQA.Selenium.Chrome
Imports OpenQA.Selenium.Support.UI
Imports OpenQA.Selenium.Keys
Imports OpenQA.Selenium.Interactions.Actions
Imports OpenQA.Selenium.Interactions
Please let me know what is causing this error?

PS: I have tried using this

Dim element As IWebElement = driver.FindElement(By.Id("userid"))
element2.SendKeys("xyz" & Keys.Enter)
This thing works.

But, I want to use actions because I do not have ID of one text box and I want to mimic keyboard.

Viewing all articles
Browse latest Browse all 15990

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>