Python QWebEngineView and Selenium

37 Views Asked by At

I have created a ui with QtDesigner Inside ui i have an area for to open browser and making some selenium activities, But i have 2 problem that i couldn't fix; 1 - When i have try open whatsapp web on QWebEngineView browser, it says WP Web working only upper than Chrome 60+ , i have upgrated and have tried everything which i found on GPT and google bu i couldn't fix,

2 - Again in same browser i want to make automation with selenium but not working at all, for ezample log in to instagram; selnd keys, By, Click and more,

how can i fix this problems,

I found an app which is ninjaGram, i have tried with trial version, its s working what i need all,

I don't want to use js or any other options, i want only with python

Solution please

Best,

import sys
import sqlite3
import os
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5 import uic
from PyQt5.QtGui import *
from PyQt5.QtWebEngineWidgets import *
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys


mainWindow = r"main.ui"
Ui_MainWindow, QtBaseClass = uic.loadUiType(mainWindow)



class MainWindow(QMainWindow, Ui_MainWindow):
    def __init__(self):
        super(MainWindow, self).__init__()
        self.setupUi(self)
        # Set initial size of web view widget
        self.web = QWebEngineView(self.webBrowserWidget)
        self.web.resize(1265, 820)
        self.web.load(QUrl("https://www.google.com"))
        self.web.urlChanged.connect(self.updateUrl)
        self.backButton.clicked.connect(self.web.back)
        self.forwardButton.clicked.connect(self.web.forward)
        self.refreshButton.clicked.connect(self.web.reload)
        self.platformsList()
        self.logInButton.clicked.connect(self.logInToAccount)



    def logInToAccount(self):
       pass



if __name__ == "__main__":
    try:
        app = QApplication(sys.argv)
        window = MainWindow()
        window.show()
        sys.exit(app.exec_())
    except Exception as e:
        print("Error occurred:", str(e))

0

There are 0 best solutions below