Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using OpenQA.Selenium.Chrome;
- using OpenQA.Selenium.Interactions;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using OpenQA.Selenium.Support.UI;
- using OpenQA.Selenium;
- using System.Xml.Linq;
- namespace SeleniumNo1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- ChromeDriver driver = new ChromeDriver();
- private void Button1_Click(object sender, EventArgs e)
- {
- driver.Navigate().GoToUrl("https://poshmark.com/create-listing");
- }
- private void Button2_Click(object sender, EventArgs e)
- {
- var title = driver.FindElementByCssSelector("#content > div > div > div:nth-child(2) > section:nth-child(3) > div:nth-child(1) > div.col-x24.col-l20 > input");
- if (title != null) ;
- {
- Actions actions = new Actions(driver);
- actions.MoveToElement(title);
- actions.Click();
- actions.SendKeys("Title controled by t3cho");
- actions.Build().Perform();
- }
- var price = driver.FindElementByCssSelector("#content > div > div > div:nth-child(2) > section:nth-child(9) > div > div > div.col-x24.col-l20 > input.form__text.listing-editor__input--half.p--4");
- if (price != null) ;
- {
- Actions actions = new Actions(driver);
- actions.MoveToElement(price);
- actions.Click();
- actions.SendKeys("22.50");
- actions.Build().Perform();
- }
- WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
- IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
- wait.Until(ExpectedConditions.
- ElementToBeClickable(By.XPath("//span[@data-et-name='category']/ancestor::div[contains(@class,'isting-editor__input--half')][1]")))
- .Click();
- js.ExecuteScript("arguments[0].click()", driver.FindElement(By.LinkText("Accessories")));
- js.ExecuteScript("arguments[0].click()", driver.FindElement(By.LinkText("Glasses")));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement