Best Python code snippet using SeleniumBase
models.py
Source: models.py
1from . import db2from . import ma3from sqlalchemy.sql import func4# # For development purposes5# from flask import Flask6# from flask_sqlalchemy import SQLAlchemy7# from flask_marshmallow import Marshmallow8# app = Flask(__name__)9# DB_NAME = 'database.db'10# app.config['SECRET_KEY'] = 'this_is_my_secret'11# app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{DB_NAME}'12# db = SQLAlchemy(app)13# ma = Marshmallow()14# db.init_app(app)15# # For development purposes \16class Month(db.Model):17 id = db.Column(db.Integer, primary_key=True)18 month = db.Column(db.String(64), unique=True)19 build_backref = db.relationship('Build', backref='month')20 execution_run_backref = db.relationship('ExecutionRun', backref='month')21class Build(db.Model):22 id = db.Column(db.Integer, primary_key=True)23 build_name = db.Column(db.String(128), unique=True)24 execution_run_backref = db.relationship('ExecutionRun', backref='build')25 month_id = db.Column(db.Integer, db.ForeignKey('month.id'))26class ExecutionRun(db.Model):27 id = db.Column(db.Integer, primary_key=True)28 execution_run_name = db.Column(db.String(128))29 build_id = db.Column(db.Integer, db.ForeignKey('build.id'))30 month_id = db.Column(db.Integer, db.ForeignKey('month.id'))31class ExecutionRunSchema(ma.Schema):32 class Meta:33 model = ExecutionRun34 fields = ('id', 'execution_run_name', 'build_id', 'month_id')35 ordered = True36class BuildSchema(ma.Schema):37 class Meta:38 model = Build39 fields = ('id', 'build_name', 'month_id')40 ordered = True41class MonthSchema(ma.Schema):42 executions = ma.Nested(BuildSchema, many=True)43 class Meta:44 model = Month45 fields = ('id', 'month')46 ordered = True47execution_run_schema = ExecutionRunSchema()48all_execution_run_schema = ExecutionRunSchema(many=True)49build_schema = BuildSchema()50all_build_schema = BuildSchema(many=True)51month_schema = MonthSchema()52all_month_schema = MonthSchema(many=True)53if __name__ == '__main__':54 db.create_all()55 july = Month(month='July')56 august = Month(month='August')57 september = Month(month='September')58 commit_1 = Build(build_name='commit_1', month=july)59 commit_2 = Build(build_name='commit_2', month=july)60 commit_3 = Build(build_name='commit_3', month=august)61 commit_4 = Build(build_name='commit_4', month=august)62 commit_5 = Build(build_name='commit_5', month=august)63 commit_6 = Build(build_name='commit_6', month=august)64 commit_7 = Build(build_name='commit_7', month=september)65 commit_8 = Build(build_name='commit_8', month=september)66 commit_9 = Build(build_name='commit_9', month=september)67 commit_10 = Build(build_name='commit_10', month=september)68 run_1 = ExecutionRun(execution_run_name='run_1', build=commit_1, month=july)69 run_2 = ExecutionRun(execution_run_name='run_2', build=commit_1, month=july)70 run_3 = ExecutionRun(execution_run_name='run_3', build=commit_2, month=july)71 run_4 = ExecutionRun(execution_run_name='run_4', build=commit_2, month=july)72 run_5 = ExecutionRun(execution_run_name='run_5', build=commit_3, month=august)73 run_6 = ExecutionRun(execution_run_name='run_6', build=commit_3, month=august)74 run_7 = ExecutionRun(execution_run_name='run_7', build=commit_4, month=august)75 run_8 = ExecutionRun(execution_run_name='run_8', build=commit_4, month=august)76 run_9 = ExecutionRun(execution_run_name='run_9', build=commit_5, month=august)77 run_10 = ExecutionRun(execution_run_name='run_10', build=commit_5, month=august)78 run_11 = ExecutionRun(execution_run_name='run_11', build=commit_6, month=august)79 run_12 = ExecutionRun(execution_run_name='run_12', build=commit_6, month=august)80 run_13 = ExecutionRun(execution_run_name='run_13', build=commit_7, month=september)81 run_14 = ExecutionRun(execution_run_name='run_14', build=commit_7, month=september)82 run_15 = ExecutionRun(execution_run_name='run_15', build=commit_8, month=september)83 run_16 = ExecutionRun(execution_run_name='run_16', build=commit_8, month=september)84 run_17 = ExecutionRun(execution_run_name='run_17', build=commit_9, month=september)85 run_18 = ExecutionRun(execution_run_name='run_18', build=commit_9, month=september)86 run_19 = ExecutionRun(execution_run_name='run_19', build=commit_10, month=september)87 run_20 = ExecutionRun(execution_run_name='run_20', build=commit_10, month=september)88 run_21 = ExecutionRun(execution_run_name='run_21', build=commit_10, month=september)89 db.session.add_all([july, august, commit_1, commit_2, commit_3, commit_4, commit_5, commit_6, commit_7, commit_8, commit_9, commit_10, run_1, run_2, run_3, run_4, run_5, run_6, run_7, run_8, run_9, run_10, run_11, run_12, run_13, run_14, run_15, run_16, run_17, run_18, run_19, run_20, run_21,])90 db.session.commit()91 # july = Month.query.filter_by(month='July').first()92 # august = Month.query.filter_by(month='August').first()93 # commit_1 = Build.query.filter_by(build_name='commit_1').first()94 # commit_2 = Build.query.filter_by(build_name='commit_2').first()95 # commit_3 = Build.query.filter_by(build_name='commit_3').first()96 # commit_4 = Build.query.filter_by(build_name='commit_4').first()97 # commit_5 = Build.query.filter_by(build_name='commit_5').first()98 # run_1 = ExecutionRun.query.filter_by(execution_run_name='run_1').first()99 # run_2 = ExecutionRun.query.filter_by(execution_run_name='run_2').first()100 # run_3 = ExecutionRun.query.filter_by(execution_run_name='run_3').first()101 # run_4 = ExecutionRun.query.filter_by(execution_run_name='run_4').first()102 # run_5 = ExecutionRun.query.filter_by(execution_run_name='run_5').first()103 # run_6 = ExecutionRun.query.filter_by(execution_run_name='run_6').first()104 # run_7 = ExecutionRun.query.filter_by(execution_run_name='run_7').first()105 # run_8 = ExecutionRun.query.filter_by(execution_run_name='run_8').first()106 # run_9 = ExecutionRun.query.filter_by(execution_run_name='run_9').first()...
gui_test_runner.py
Source: gui_test_runner.py
...84 'pytest test_fail.py --browser=chrome')85 def run_6(self):86 os.system(87 'pytest test_suite.py --browser=chrome --html=report.html')88 def run_7(self):89 os.system(90 'pytest test_deferred_asserts.py --browser=chrome')91if __name__ == "__main__":92 root = Tk()93 root.title("Select Test Job To Run")94 root.minsize(500, 420)95 app = App(root)...
Krasivij_kalkulator.py
Source: Krasivij_kalkulator.py
...29 def run_5(self):30 self.lcdNumber_5.display(int(self.lineEdit.text()) ** int(self.lineEdit_2.text()))31 def run_6(self):32 self.lcdNumber_6.display(math.sqrt(int(self.lineEdit.text())))33 def run_7(self):34 self.lcdNumber_7.display(math.sqrt(int(self.lineEdit_2.text())))35 def run_8(self):36 self.lcdNumber_8.display(math.factorial(int(self.lineEdit.text())))37 def run_9(self):38 self.lcdNumber_9.display(math.factorial(int(self.lineEdit_2.text())))39app = QApplication(sys.argv)40ex = MyWidget()41ex.show()...
Check out the latest blogs from LambdaTest on this topic:
Web applications continue to evolve at an unbelievable pace, and the architecture surrounding web apps get more complicated all of the time. With the growth in complexity of the web application and the development process, web application testing also needs to keep pace with the ever-changing demands.
JavaScript is one of the most widely used programming languages. This popularity invites a lot of JavaScript development and testing frameworks to ease the process of working with it. As a result, numerous JavaScript testing frameworks can be used to perform unit testing.
With the change in technology trends, there has been a drastic change in the way we build and develop applications. It is essential to simplify your programming requirements to achieve the desired outcomes in the long run. Visual Studio Code is regarded as one of the best IDEs for web development used by developers.
Continuous integration is a coding philosophy and set of practices that encourage development teams to make small code changes and check them into a version control repository regularly. Most modern applications necessitate the development of code across multiple platforms and tools, so teams require a consistent mechanism for integrating and validating changes. Continuous integration creates an automated way for developers to build, package, and test their applications. A consistent integration process encourages developers to commit code changes more frequently, resulting in improved collaboration and code quality.
In today’s world, an organization’s most valuable resource is its customers. However, acquiring new customers in an increasingly competitive marketplace can be challenging while maintaining a strong bond with existing clients. Implementing a customer relationship management (CRM) system will allow your organization to keep track of important customer information. This will enable you to market your services and products to these customers better.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!