using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using OpenQA.Selenium.Chrome; using OpenQA.Selenium; namespace Marketplace { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string url = "https://www.facebook.com/"; ChromeDriver driver; Thread th; private void Form1_Load(object sender, EventArgs e) { ChromeOptions options = new ChromeOptions(); options.AddArguments("--disable-notifications"); // to disable notification driver = new ChromeDriver(options); driver.Navigate().GoToUrl(url); } private void button1_Click(object sender, EventArgs e) { driver.FindElement(By.XPath("//button[normalize-space()='Akceptuj wszystkie']")).Click(); driver.FindElement(By.XPath("//input[@id='email']")).SendKeys("login"); driver.FindElement(By.XPath("//input[@id='pass']")).SendKeys("password"); driver.FindElement(By.XPath("//button[contains(text(),'Zaloguj się')]")).Click(); //login driver.FindElement(By.XPath("//*[name()='path' and contains(@d,'M17.5 23.7')]")).Click(); Thread.Sleep(2000); driver.FindElement(By.XPath("//div[@class='j83agx80 cbu4d94t d6urw2fd dp1hu0rb l9j0dhe7 du4w35lb']//span[@class='d2edcug0 hpfvmrgz qv66sw1b c1et5uql lr9zc1uh a8c37x1j keod5gw0 nxhoafnm aigsh9s9 d3f4x2em fe6kdd0r mau55g9w c8b282yb iv3no6db jq4qci2q a3bd9o3v lrazzd5p knomaqxo']//span[1]")).Click(); Thread.Sleep(2000); driver.FindElement(By.XPath("//span[contains(text(),'Przedmiot na sprzedaż')]")).Click(); Thread.Sleep(3000); driver.FindElement(By.XPath("//div[@class='s45kfl79 emlxlaya bkmhp75w spb7xbtv bp9cbjyn rt8b4zig n8ej3o3l agehan2d sk4xxmp2 rq0escxv pq6dq46d taijpn5t l9j0dhe7 tdjehn4e qypqp5cg q676j6op']//i[@class='hu5pjgll lzf7d6o1']")).Click(); // now i can choose a photo from my computer } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)