Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [TestMethod]
- public void SeleniumElementLocationExam()
- {
- Driver.Navigate().GoToUrl("https://www.ultimateqa.com/simple-html-elements-for-automation/");
- // Click any radio button
- Driver.FindElement(By.XPath("//*[@id='et-boc']/div/div[3]/div/div[1]/div[7]/div/div/div/form/input[1]")).Click();
- // Select one checkbox
- Driver.FindElement(By.XPath("//*[@id='et-boc']/div/div[3]/div/div[1]/div[8]/div/div/div/form/input[1]")).Click();
- // Select Audi from the dropdown
- Driver.FindElement(By.TagName("select")).Click();
- Driver.FindElement(By.XPath("//*[@id='et-boc']/div/div[3]/div/div[1]/div[9]/div/div/div/select/option[4]")).Click();
- // Open Tab2 and asser it is openned
- Driver.FindElement(By.XPath("//*[@id='et-boc']/div/div[3]/div/div[1]/div[10]/ul/li[2]")).Click();
- Thread.Sleep(1000);
- Assert.AreEqual("Tab 2 content", Driver.FindElement(By.XPath("//*[@id='et-boc']/div/div[3]/div/div[1]/div[10]/div/div[2]/div")).Text);
- // In the HTML table with ID, highlight one of the salary cells
- HighlightElementUsingJavaScript(By.XPath("//*[@id='htmlTableId']/tbody/tr[2]/td[3]"));
- //Highlight the center section called "Highlight me", but you can only
- //highlight the highest level div for that element. The top parent div.
- //Hint, this is the class -
- //et_pb_column et_pb_column_1_3 et_pb_column_10 et_pb_css_mix_blend_mode_passthrough
- HighlightElementUsingJavaScript(By.CssSelector("#et-boc > div > div.et_pb_section.et_pb_section_4.et_section_regular > div > div.et_pb_column.et_pb_column_1_3.et_pb_column_10.et_pb_css_mix_blend_mode_passthrough"));
- HighlightElementUsingJavaScript(
- By.XPath("//*[@class='et_pb_column et_pb_column_1_3 et_pb_column_10 et_pb_css_mix_blend_mode_passthrough']"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement