1

I am trying to do some web-scraping in C++ (I know that performance isn't usually best there), and I need to login to some sites, that have login site called login.aspx. I found some libraries that allows login, but I don't make any of them work (cpr, curl). So the only way that I manage to login was using python and Selenium. But I need to make my program in C++, 'cos python is not on computer that this program will run on. I tried webdriverxx but since I am not very skilled C++ programmer it doesn't work. Output from it: https://pastebin.com/wMFreNFc with using code from github page:

#include <webdriverxx/webdriverxx.h>
using namespace webdriverxx;

int main() {
    WebDriver firefox = Start(Firefox());
    firefox
        .Navigate("http://google.com")
        .FindElement(ByCss("input[name=q]"))
        .SendKeys("Hello, world!")
        .Submit();
    return 0;    
}

What I need in the end is a library in C++ that will some how be able to login. Thank you for any help

Note: I am on Ubuntu 20.04 LTS, installed as minimal, but program will run on the windows machine at the end

nicoebd
  • 46
  • 5
  • It looks like you forgot linking curl library during compilation. With g++ you do it using the argument -lcurl – Cem Dec 07 '20 at 11:03
  • @Cem woooow, it's working, can I somehow get rid of running Selenium server.jar in other window ? I don't mean like running it from C++, but somehow make it part of program to not need to install java ? – nicoebd Dec 08 '20 at 07:28
  • It worked, until now, I wanted to put code into function like here https://pastebin.com/2usHy1jT And when I try to compile it using g++ scraper.cpp -lcurl it gave this error https://pastebin.com/TeJkB6my I don't fully understand C++ functions but I want to make it working – nicoebd Dec 08 '20 at 08:17

0 Answers0