kevin
kevin

Reputation: 49

Various questions regarding Selenium Webdriver functionality

I am new to Selenium, and I was wondering if anyone might be able to answer 2 questions I had regarding its functionality.

  1. I use Selenium Webdriver in Eclipse. In order to launch my test class I go to Run -> Run As -> Java Application. Would it be possible for me to have a popup/input box that is not part of the page I want to test accept input values entered by me, which I can then use as test data?

For example, when I start the test run, I see an input box that pops up before the actual page to be tested that says "What URL do you want to test?" and when I enter a value, then submit, the driver.get("

  1. The page that I am attempting to test has a "Thank You" page that comes after a user submits their information via a javascript form. Within that Thank You page there are various tracking pixels that I need to verify exist. However they are located within a javascript tag, and have no element IDs. The way we verify them now is by opening the source code of the TY page, then manually checking that various values are found, which imply that the tracking pixel is there. How would I be able to verify the existence of the pixels in that case?

Upvotes: 1

Views: 173

Answers (2)

sukumar kutagulla
sukumar kutagulla

Reputation: 1

I would suggest if you are facing popup related issues, you can either accept or reject popup, if it comes before launching of your application.

Upvotes: 0

Bob Ezuba
Bob Ezuba

Reputation: 510

Unfortunately, I don't have enough merits to post my suggestion as a comment, therefore I will post it as an answer.

Question 1: You can use JOptionPane input box to get the test data before or after the page loads and then interact with the page using selenium built in functions.

Question 2: driver.getPageSource() should return a string representation of the HTML code and then you can check using String.contains("what you are looking for") to find the pixels.

I hope this helps.

Upvotes: 1

Related Questions