2024-02-01

How to cache playwright-python contexts for testing?

I am doing some web scraping using playwright-python>=1.41, and have to launch the browser in a headed mode (e.g. launch(headless=False).

For CI testing, I would like to somehow cache the headed interactions with Chromium, to enable offline testing:

  • First invocation: uses Chromium to make real-world HTTP transactions
  • Later invocations: uses Chromium, but all HTTP transactions read from a cache

How can this be done? I can't find any clear answers on how to do this.



2024-01-30

Issue while executing the multi-layer commands on windows

The below is executing on windows:

C:\cygwin\bin\bash.exe  -c "echo abc; echo 1 ; c:/cygwin/bin/bash.exe -c "c:/cygwin/bin/tcsh.exe echo def; pwd "  "

Running the above command, and getting the output as:

abc
1
[PPP@machine1 ...Users/PPP]$ 

Desired Output:

 abc
 1
 def
 C:\Users\PPP 

In all, I want the commands under tcsh to also work (In above command, it is "echo def; pwd"). How can I have the progress on it?



Sitecore instance styles are not available after installation [closed]

After Installing sitecore instance, My login page is looking like this enter image description here

after login it is looking without styling you can find the image below enter image description here

Can you please help me in this

I don't have any idea what to do next



2024-01-29

Problem moving lines (one by one) from one text file to another

I try to create a program that moves the first line in a text file to another and then remove said line in the first file (i.e. they are moved one by one). This should continue until there aren't any more lines in the first file to be moved to the second file.

The problem I have is that the program freezes and won't quit properly. I have experimented with the code and reached the conclusion that the error probably is in the counting of lines but that's all...

Here is the code:

# Create the second file
open("file2.txt", 'w', encoding="utf-8-sig").close()

# Find out how many lines in file one
lines = open("file1.txt", 'r', encoding="utf-8-sig").readlines()

# Loop the amount of lines
while range(len(lines)) != 0:
    
    # Get the first line in the first file
    first_line = open("file1.txt", 'r', encoding="utf-8-sig").readline()
    
    # Write the line to the second file
    out = open("file2.txt", 'a', encoding="utf-8-sig")
    out.write(first_line)
    
    # Remove the first line from the first file
    all_lines = open("file1.txt", 'r', encoding="utf-8-sig").readlines()
    new_file = open("file1.txt", 'w', encoding="utf-8-sig")
    new_file.writelines(all_lines[1:])
    new_file.close()

I would really appreciate some help with the code and critic in general.



2024-01-28

.NET core minmal APIs not connecting with react native app (Expo CLI)

I am trying to connect my .Net core minmal apis backend with react native but it keeps giving me network error, I dont know what I am doing wrong. I have double checked the url the ip address too many times but still could not make it to work. Please , I would appreciate your help.

I have tried the same application with a node backend it worked fine for node, may be because node was using http while .net backend is using https but I still do not understand if there is any thing wrong.

enter image description here

enter image description here

enter image description here

enter image description here